|
@ -8,10 +8,13 @@ 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 django.db import models |
|
|
|
|
|
from django.contrib.auth.models import User |
|
|
|
|
|
|
|
|
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Novinky, Organizator |
|
|
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Novinky, Organizator |
|
|
import autocomplete_light |
|
|
import autocomplete_light |
|
|
|
|
|
|
|
|
|
|
|
uzivatele = [(user, u"{} ({})".format(user.get_full_name(), user)) for user in User.objects.filter(is_staff=True)] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def predvypln_prihlaseneho(*pole): |
|
|
def predvypln_prihlaseneho(*pole): |
|
|
u"""Dekorátor pro Adminy. Předvyplní do *polí přihlášeného uživatele. |
|
|
u"""Dekorátor pro Adminy. Předvyplní do *polí přihlášeného uživatele. |
|
@ -288,13 +291,14 @@ admin.site.register(Reseni, ReseniAdmin) |
|
|
|
|
|
|
|
|
from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget |
|
|
from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget |
|
|
|
|
|
|
|
|
#TODO: Autocomplete autor/opravovatel |
|
|
|
|
|
|
|
|
|
|
|
class ProblemAdminForm(forms.ModelForm): |
|
|
class ProblemAdminForm(forms.ModelForm): |
|
|
text_zadani = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_zadani')) |
|
|
text_zadani = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_zadani')) |
|
|
text_reseni = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_reseni')) |
|
|
text_reseni = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_reseni')) |
|
|
text_org = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_org')) |
|
|
text_org = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_org')) |
|
|
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False) |
|
|
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False) |
|
|
|
|
|
autor = forms.ChoiceField(choices=uzivatele) |
|
|
|
|
|
opravovatel = forms.ChoiceField(choices=uzivatele) |
|
|
class Meta: |
|
|
class Meta: |
|
|
model = Problem |
|
|
model = Problem |
|
|
exclude = [] |
|
|
exclude = [] |
|
@ -375,6 +379,7 @@ admin.site.register(Soustredeni, SoustredeniAdmin) |
|
|
class NovinkyAdminForm(forms.ModelForm): |
|
|
class NovinkyAdminForm(forms.ModelForm): |
|
|
text = forms.CharField(widget=CKEditorWidget(), required=False, |
|
|
text = forms.CharField(widget=CKEditorWidget(), required=False, |
|
|
**field_labels(Novinky, 'text')) |
|
|
**field_labels(Novinky, 'text')) |
|
|
|
|
|
autor = forms.ChoiceField(choices=uzivatele) |
|
|
class Meta: |
|
|
class Meta: |
|
|
model = Novinky |
|
|
model = Novinky |
|
|
exclude = [] |
|
|
exclude = [] |
|
|