<commit_before>from django.contrib import admin
from django.db import models
from tinymce.widgets import AdminTinyMCE

from applications.models import Period, CampVoucher, Event, EventApplication, PracticeExam, PracticeExamApplication
from applications.models import PracticeExamProblem
from applications.models import TheoryExam, TheoryExamQuestion, TheoryExamQuestionOption
from applications.forms import EventApplicationAdminForm


admin.site.register(Period)
admin.site.register(CampVoucher)


class EventAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': AdminTinyMCE()},
    }

admin.site.register(Event, EventAdmin)


class EventApplicationAdmin(admin.ModelAdmin):
    form = EventApplicationAdminForm
    readonly_fields = ('user', 'event')

admin.site.register(EventApplication, EventApplicationAdmin)
admin.site.register(PracticeExam)
admin.site.register(PracticeExamProblem)


class TheoryExamQuestionOptionInline(admin.TabularInline):
    model = TheoryExamQuestionOption


class TheoryExamQuestionAdmin(admin.ModelAdmin):
    inlines = [
        TheoryExamQuestionOptionInline
    ]

admin.site.register(TheoryExamQuestion, TheoryExamQuestionAdmin)
admin.site.register(TheoryExam)<commit_msg>Disabled adding applications through admin menu<commit_after>from django.contrib import admin
from django.db import models
from tinymce.widgets import AdminTinyMCE

from applications.models import Period, CampVoucher, Event, EventApplication, PracticeExam, PracticeExamApplication
from applications.models import PracticeExamProblem
from applications.models import TheoryExam, TheoryExamQuestion, TheoryExamQuestionOption
from applications.forms import EventApplicationAdminForm


admin.site.register(Period)
admin.site.register(CampVoucher)


class EventAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': AdminTinyMCE()},
    }

admin.site.register(Event, EventAdmin)


class EventApplicationAdmin(admin.ModelAdmin):
    form = EventApplicationAdminForm
    readonly_fields = ('user', 'event')

    def has_add_permission(self, request):
        return False

admin.site.register(EventApplication, EventApplicationAdmin)
admin.site.register(PracticeExam)
admin.site.register(PracticeExamProblem)


class TheoryExamQuestionOptionInline(admin.TabularInline):
    model = TheoryExamQuestionOption


class TheoryExamQuestionAdmin(admin.ModelAdmin):
    inlines = [
        TheoryExamQuestionOptionInline
    ]

admin.site.register(TheoryExamQuestion, TheoryExamQuestionAdmin)
admin.site.register(TheoryExam)
{'fraction_non_alphanumeric': 0.07421724004638577, 'fraction_numerical': 0.0, 'mean_word_length': 6.479768786127168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7536331', 'n_tokens_mistral': 714, 'n_tokens_neox': 701, 'n_words': 143}