Browse Source

seminar | prispevek | zakladni admin s CKEditorem

remotes/origin/temata
Bc. Petr Pecha 9 years ago
parent
commit
5c415a10c1
  1. 20
      seminar/admin.py
  2. 18
      seminar/migrations/0038_change_meta_prispevek.py
  3. 14
      seminar/models.py

20
seminar/admin.py

@ -11,7 +11,7 @@ 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, Soustredeni_Organizatori, Novinky, Organizator
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Novinky, Organizator, Prispevek
from autocomplete_light import shortcuts as autocomplete_light
@ -360,6 +360,24 @@ create_modeladmin(ProblemZadanyAdmin, Problem, 'ProblemZadany', verbose_name=u'P
#admin.site.register(Problem, ProblemAdmin)
### Prispevek (k tematkum)
class PrispevekAdminForm(forms.ModelForm):
text_org = forms.CharField(widget=CKEditorWidget(), required=False,
**field_labels(Prispevek, 'text_org'))
text_resitel = forms.CharField(widget=CKEditorWidget(), required=False,
**field_labels(Prispevek, 'text_resitel'))
class Meta:
model = Prispevek
exclude = []
class PrispevekAdmin(VersionAdmin):
form = PrispevekAdminForm
list_display = ['nazev', 'problem', 'reseni', 'zverejnit']
admin.site.register(Prispevek, PrispevekAdmin)
### Soustredeni
class SoustredeniAdminForm(forms.ModelForm):

18
seminar/migrations/0038_change_meta_prispevek.py

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('seminar', '0037_prispevek'),
]
operations = [
migrations.AlterModelOptions(
name='prispevek',
options={'verbose_name': 'P\u0159\xedsp\u011bvek k probl\xe9mu', 'verbose_name_plural': 'P\u0159\xedsp\u011bvky k probl\xe9m\u016fm'},
),
]

14
seminar/models.py

@ -595,6 +595,20 @@ class Prispevek(SeminarModelBase):
text_resitel = models.TextField('Řešitelský text', blank = True, null = True)
zverejnit = models.BooleanField('Zveřejnit?')
class Meta:
verbose_name = 'Příspěvek k problému'
verbose_name_plural = 'Příspěvky k problémům'
def __unicode__(self):
if self.reseni:
return force_unicode(self.nazev) + ' (' + \
force_unicode(self.reseni.resitel) + ') <Problem: ' + \
force_unicode(self.problem) + '>'
else:
return force_unicode(self.nazev) + ' <Problem: ' + \
force_unicode(self.problem) + '>'
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible
class Organizator(models.Model):

Loading…
Cancel
Save