seminar | prispevek | zakladni admin s CKEditorem
This commit is contained in:
parent
0b56226c5f
commit
5c415a10c1
3 changed files with 51 additions and 1 deletions
|
@ -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
Normal file
18
seminar/migrations/0038_change_meta_prispevek.py
Normal file
|
@ -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'},
|
||||
),
|
||||
]
|
|
@ -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…
Reference in a new issue