From be3cd4b28363a3145dfbc15e648a55796f36ee1f Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Thu, 23 Jul 2015 20:12:29 +0200 Subject: [PATCH] Pridana polozka pro typ soustredeni/akce --- seminar/admin.py | 4 ++-- seminar/migrations/0026_soustredeni_typ.py | 20 ++++++++++++++++++++ seminar/models.py | 10 ++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 seminar/migrations/0026_soustredeni_typ.py diff --git a/seminar/admin.py b/seminar/admin.py index de4c800d..e6242447 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -319,10 +319,10 @@ class SoustredeniAdminForm(forms.ModelForm): class SoustredeniAdmin(reversion.VersionAdmin): form = SoustredeniAdminForm fieldsets = [ - (None, {'fields': ['rocnik', 'misto', 'verejne_db', 'text']}), + (None, {'fields': ['rocnik', 'misto', 'typ', 'verejne_db', 'text']}), (u'Data', {'fields': ['datum_zacatku', 'datum_konce']}), ] - list_display = ['rocnik', 'misto', 'datum_zacatku', 'verejne'] + list_display = ['rocnik', 'misto', 'datum_zacatku', 'typ', 'verejne'] inlines = [Soustredeni_UcastniciInline] list_filter = ['rocnik'] view_on_site = Soustredeni.verejne_url diff --git a/seminar/migrations/0026_soustredeni_typ.py b/seminar/migrations/0026_soustredeni_typ.py new file mode 100644 index 00000000..46d3416f --- /dev/null +++ b/seminar/migrations/0026_soustredeni_typ.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0025_zmena_cesty_nahravani_obrazku'), + ] + + operations = [ + migrations.AddField( + model_name='soustredeni', + name='typ', + field=models.CharField(default=b'podzimni', max_length=16, verbose_name='typ akce', choices=[(b'jarni', 'Jarn\xed soust\u0159ed\u011bn\xed'), (b'podzimni', 'Podzimn\xed soust\u0159ed\u011bn\xed'), (b'sraz', 'Nepravideln\xfd sraz')]), + preserve_default=True, + ), + ] diff --git a/seminar/models.py b/seminar/models.py index fc8e3456..2880d197 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -565,6 +565,16 @@ class Soustredeni(SeminarModelBase): text = models.TextField(u'text k soustředění (HTML)', blank=True, default='') + TYP_JARNI = 'jarni' + TYP_PODZIMNI = 'podzimni' + TYP_SRAZ = 'sraz' + TYP_CHOICES = [ + (TYP_JARNI, u'Jarní soustředění'), + (TYP_PODZIMNI, u'Podzimní soustředění'), + (TYP_SRAZ, u'Nepravidelný sraz'), + ] + typ = models.CharField(u'typ akce', max_length=16, choices=TYP_CHOICES, blank=False, default=TYP_PODZIMNI) + def __str__(self): return force_unicode(u'%s (%s)' % (self.misto, self.datum_zacatku))