|
@ -1,10 +1,12 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
from django.contrib import admin |
|
|
from django.contrib import admin |
|
|
from django import forms |
|
|
from django import forms |
|
|
|
|
|
from django.forms import widgets |
|
|
import reversion |
|
|
import reversion |
|
|
from solo.admin import SingletonModelAdmin |
|
|
from solo.admin import SingletonModelAdmin |
|
|
from ckeditor.widgets import CKEditorWidget |
|
|
from ckeditor.widgets import CKEditorWidget |
|
|
from django.db.models import Count |
|
|
from django.db.models import Count |
|
|
|
|
|
from django.db import models |
|
|
|
|
|
|
|
|
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici |
|
|
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici |
|
|
import autocomplete_light |
|
|
import autocomplete_light |
|
@ -31,6 +33,9 @@ class CisloInline(admin.TabularInline): |
|
|
fields = ['cislo', 'datum_vydani', 'datum_deadline', 'verejne_db', 'poznamka'] |
|
|
fields = ['cislo', 'datum_vydani', 'datum_deadline', 'verejne_db', 'poznamka'] |
|
|
readonly_fields = ['cislo'] |
|
|
readonly_fields = ['cislo'] |
|
|
extra = 0 |
|
|
extra = 0 |
|
|
|
|
|
formfield_overrides = { |
|
|
|
|
|
models.TextField: {'widget': forms.TextInput}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def has_add_permission(self, req): return False |
|
|
def has_add_permission(self, req): return False |
|
|
|
|
|
|
|
@ -39,16 +44,21 @@ class PrilohaReseniInline(admin.StackedInline): |
|
|
model = PrilohaReseni |
|
|
model = PrilohaReseni |
|
|
fields = ['timestamp', 'soubor', 'poznamka'] |
|
|
fields = ['timestamp', 'soubor', 'poznamka'] |
|
|
readonly_fields = ['timestamp'] |
|
|
readonly_fields = ['timestamp'] |
|
|
|
|
|
formfield_overrides = { |
|
|
|
|
|
models.TextField: {'widget': forms.TextInput}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
extra = 0 |
|
|
extra = 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ReseniKProblemuInline(admin.TabularInline): |
|
|
class ReseniKProblemuInline(admin.TabularInline): |
|
|
form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['resitel'], fields=['resitel']) |
|
|
form = autocomplete_light.modelform_factory(Reseni, autocomplete_fields=['resitel'], fields=['resitel']) |
|
|
model = Reseni |
|
|
model = Reseni |
|
|
fields = ['resitel', 'forma', 'body', 'cislo_body', 'timestamp', 'poznamka'] |
|
|
fields = ['resitel', 'forma', 'body', 'cislo_body', 'timestamp', 'poznamka'] |
|
|
readonly_fields = ['timestamp'] |
|
|
readonly_fields = ['timestamp'] |
|
|
extra = 0 |
|
|
extra = 0 |
|
|
|
|
|
formfield_overrides = { |
|
|
|
|
|
models.TextField: {'widget': forms.TextInput}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def get_queryset(self, request): |
|
|
def get_queryset(self, request): |
|
|
qs = super(ReseniKProblemuInline, self).get_queryset(request) |
|
|
qs = super(ReseniKProblemuInline, self).get_queryset(request) |
|
@ -68,6 +78,9 @@ class ReseniKResiteliInline(admin.TabularInline): |
|
|
fields = ['problem', 'forma', 'body', 'cislo_body', 'timestamp', 'poznamka'] |
|
|
fields = ['problem', 'forma', 'body', 'cislo_body', 'timestamp', 'poznamka'] |
|
|
readonly_fields = ['timestamp', 'problem'] |
|
|
readonly_fields = ['timestamp', 'problem'] |
|
|
extra = 0 |
|
|
extra = 0 |
|
|
|
|
|
formfield_overrides = { |
|
|
|
|
|
models.TextField: {'widget': forms.TextInput}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def has_add_permission(self, req): return False |
|
|
def has_add_permission(self, req): return False |
|
|
|
|
|
|
|
@ -89,6 +102,9 @@ class Soustredeni_UcastniciInline(admin.TabularInline): |
|
|
model = Soustredeni_Ucastnici |
|
|
model = Soustredeni_Ucastnici |
|
|
fields = ['resitel', 'poznamka', ] |
|
|
fields = ['resitel', 'poznamka', ] |
|
|
extra = 0 |
|
|
extra = 0 |
|
|
|
|
|
formfield_overrides = { |
|
|
|
|
|
models.TextField: {'widget': forms.TextInput}, |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def get_queryset(self, request): |
|
|
def get_queryset(self, request): |
|
|
qs = super(Soustredeni_UcastniciInline, self).get_queryset(request) |
|
|
qs = super(Soustredeni_UcastniciInline, self).get_queryset(request) |
|
|