Admin: ve výběru uživatele zobraz celé jméno
a jen ty, kteří se mohou přihlásit do adminu.
This commit is contained in:
parent
7de84440fb
commit
660f7d826c
1 changed files with 6 additions and 1 deletions
|
@ -8,10 +8,13 @@ from solo.admin import SingletonModelAdmin
|
|||
from ckeditor.widgets import CKEditorWidget
|
||||
from django.db.models import Count
|
||||
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
|
||||
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):
|
||||
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
|
||||
|
||||
#TODO: Autocomplete autor/opravovatel
|
||||
|
||||
class ProblemAdminForm(forms.ModelForm):
|
||||
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_org = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_org'))
|
||||
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False)
|
||||
autor = forms.ChoiceField(choices=uzivatele)
|
||||
opravovatel = forms.ChoiceField(choices=uzivatele)
|
||||
class Meta:
|
||||
model = Problem
|
||||
exclude = []
|
||||
|
@ -375,6 +379,7 @@ admin.site.register(Soustredeni, SoustredeniAdmin)
|
|||
class NovinkyAdminForm(forms.ModelForm):
|
||||
text = forms.CharField(widget=CKEditorWidget(), required=False,
|
||||
**field_labels(Novinky, 'text'))
|
||||
autor = forms.ChoiceField(choices=uzivatele)
|
||||
class Meta:
|
||||
model = Novinky
|
||||
exclude = []
|
||||
|
|
Loading…
Reference in a new issue