Browse Source

Update adminu s help_text-em

remotes/origin/feincms
Tomas Gavenciak 10 years ago
parent
commit
181fce9df5
  1. 14
      seminar/admin.py

14
seminar/admin.py

@ -17,6 +17,12 @@ import autocomplete_light
admin.site.register(Nastaveni, SingletonModelAdmin)
### UTILS (pro verbose_name a help_text)
def field_labels(model, fieldname):
f = [i for i in model._meta.fields if i.name == fieldname][0]
return {'label': f.verbose_name.capitalize(), 'help_text': f.help_text, }
### INLINES
class ResitelInline(admin.TabularInline):
@ -226,9 +232,9 @@ from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget
#TODO: Autocomplete autor/opravovatel
class ProblemAdminForm(forms.ModelForm):
text_zadani = forms.CharField(widget=CKEditorWidget())
text_reseni = forms.CharField(widget=CKEditorWidget())
text_org = forms.CharField(widget=CKEditorWidget())
text_zadani = forms.CharField(widget=CKEditorWidget(), **field_labels(Problem, 'text_zadani'))
text_reseni = forms.CharField(widget=CKEditorWidget(), **field_labels(Problem, 'text_reseni'))
text_org = forms.CharField(widget=CKEditorWidget(), **field_labels(Problem, 'text_org'))
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'))
class Meta:
model = Problem
@ -262,7 +268,7 @@ admin.site.register(Problem, ProblemAdmin)
### Soustredeni
class SoustredeniAdminForm(forms.ModelForm):
text = forms.CharField(widget=CKEditorWidget())
text = forms.CharField(widget=CKEditorWidget(), **field_labels(Soustredeni, 'text'))
class Meta:
model = Soustredeni
exclude = []

Loading…
Cancel
Save