Browse Source

Update modelu (poznamky, ...) a reset migraci (seminar)

remotes/origin/feincms
Tomas Gavenciak 10 years ago
parent
commit
10cfee815d
  1. 55
      seminar/migrations/0001_initial.py
  2. 71
      seminar/migrations/0003_auto_20150511_0947.py
  3. 38
      seminar/migrations/0004_auto_20150511_1215.py
  4. 22
      seminar/models.py

55
seminar/migrations/0001_initial.py

@ -15,13 +15,41 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.CreateModel(
name='VysledkyKCislu',
fields=[
('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column=b'id')),
('body', models.IntegerField(verbose_name='body za \u010d\xedslo', db_column=b'body')),
('body_celkem', models.IntegerField(verbose_name='body celkem do \u010d\xedsla', db_column=b'body_celkem')),
],
options={
'abstract': False,
'db_table': 'seminar_body_k_cislu',
'managed': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='VysledkyZaCislo',
fields=[
('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column=b'id')),
('body', models.IntegerField(verbose_name='body za \u010d\xedslo', db_column=b'body')),
],
options={
'abstract': False,
'db_table': 'seminar_body_za_cislo',
'managed': False,
},
bases=(models.Model,),
),
migrations.CreateModel( migrations.CreateModel(
name='Cislo', name='Cislo',
fields=[ fields=[
('id', models.AutoField(serialize=False, primary_key=True)), ('id', models.AutoField(serialize=False, primary_key=True)),
('cislo', models.CharField(help_text='V\u011bt\u0161inou jen "1", vyj\xedme\u010dn\u011b "7-8"', max_length=32, verbose_name='n\xe1zev \u010d\xedsla')), ('cislo', models.CharField(help_text='V\u011bt\u0161inou jen "1", vyj\xedme\u010dn\u011b "7-8", lexikograficky ur\u010dije po\u0159ad\xed v ro\u010dn\xedku!', max_length=32, verbose_name='n\xe1zev \u010d\xedsla')),
('datum_vydani', models.DateField(help_text='Datum vyd\xe1n\xed fin\xe1ln\xed verze', null=True, verbose_name='datum vyd\xe1n\xed', blank=True)), ('datum_vydani', models.DateField(help_text='Datum vyd\xe1n\xed fin\xe1ln\xed verze', null=True, verbose_name='datum vyd\xe1n\xed', blank=True)),
('datum_deadline', models.DateField(help_text='Datum pro p\u0159\xedjem \u0159e\u0161en\xed \xfaloh zadan\xfdch v tomto \u010d\xedsle', null=True, verbose_name='datum deadline', blank=True)), ('datum_deadline', models.DateField(help_text='Datum pro p\u0159\xedjem \u0159e\u0161en\xed \xfaloh zadan\xfdch v tomto \u010d\xedsle', null=True, verbose_name='datum deadline', blank=True)),
('verejne_db', models.BooleanField(default=False, verbose_name='\u010d\xedslo zve\u0159ejn\u011bno', db_column=b'verejne')),
], ],
options={ options={
'ordering': ['rocnik__rocnik', 'cislo'], 'ordering': ['rocnik__rocnik', 'cislo'],
@ -49,6 +77,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(serialize=False, primary_key=True)), ('id', models.AutoField(serialize=False, primary_key=True)),
('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')), ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')),
('soubor', models.FileField(upload_to=seminar.models.generate_filename, verbose_name='soubor')), ('soubor', models.FileField(upload_to=seminar.models.generate_filename, verbose_name='soubor')),
('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k p\u0159\xedloze \u0159e\u0161en\xed (plain text), nap\u0159. o p\u016fvodu', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
], ],
options={ options={
'ordering': ['reseni', 'timestamp'], 'ordering': ['reseni', 'timestamp'],
@ -87,6 +116,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(serialize=False, primary_key=True)), ('id', models.AutoField(serialize=False, primary_key=True)),
('body', models.IntegerField(null=True, verbose_name='body', blank=True)), ('body', models.IntegerField(null=True, verbose_name='body', blank=True)),
('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')), ('timestamp', models.DateTimeField(auto_now=True, verbose_name='vytvo\u0159eno')),
('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
('cislo_body', models.ForeignKey(related_name='bodovana_reseni', verbose_name='\u010d\xedslo pro body', blank=True, to='seminar.Cislo', null=True)), ('cislo_body', models.ForeignKey(related_name='bodovana_reseni', verbose_name='\u010d\xedslo pro body', blank=True, to='seminar.Cislo', null=True)),
('problem', models.ForeignKey(related_name='reseni', verbose_name='probl\xe9m', to='seminar.Problem')), ('problem', models.ForeignKey(related_name='reseni', verbose_name='probl\xe9m', to='seminar.Problem')),
], ],
@ -117,6 +147,7 @@ class Migration(migrations.Migration):
('mesto', models.CharField(default=b'', max_length=256, verbose_name='m\u011bsto', blank=True)), ('mesto', models.CharField(default=b'', max_length=256, verbose_name='m\u011bsto', blank=True)),
('psc', models.CharField(default=b'', max_length=32, verbose_name='PS\u010c', blank=True)), ('psc', models.CharField(default=b'', max_length=32, verbose_name='PS\u010c', blank=True)),
('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 k\xf3d zem\u011b velk\xfdmi p\xedsmeny (CZ, SK, ...)', max_length=2, verbose_name='st\xe1t')), ('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 k\xf3d zem\u011b velk\xfdmi p\xedsmeny (CZ, SK, ...)', max_length=2, verbose_name='st\xe1t')),
('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161iteli (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
], ],
options={ options={
'ordering': ['prijmeni', 'jmeno'], 'ordering': ['prijmeni', 'jmeno'],
@ -153,6 +184,7 @@ class Migration(migrations.Migration):
('mesto', models.CharField(max_length=256, verbose_name='m\u011bsto')), ('mesto', models.CharField(max_length=256, verbose_name='m\u011bsto')),
('psc', models.CharField(max_length=32, verbose_name='PS\u010c')), ('psc', models.CharField(max_length=32, verbose_name='PS\u010c')),
('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 k\xf3d zeme velk\xfdmi p\xedsmeny (CZ, SK, ...)', max_length=2, verbose_name='st\xe1t')), ('stat', django_countries.fields.CountryField(default=b'CZ', help_text='ISO 3166-1 k\xf3d zeme velk\xfdmi p\xedsmeny (CZ, SK, ...)', max_length=2, verbose_name='st\xe1t')),
('poznamka', models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka ke \u0161kole (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True)),
], ],
options={ options={
'db_table': 'seminar_skoly', 'db_table': 'seminar_skoly',
@ -161,6 +193,25 @@ class Migration(migrations.Migration):
}, },
bases=(models.Model,), bases=(models.Model,),
), ),
migrations.CreateModel(
name='Soustredeni',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('datum_zacatku', models.DateField(help_text='Prvn\xed den soust\u0159ed\u011bn\xed', null=True, verbose_name='datum za\u010d\xe1tku', blank=True)),
('datum_konce', models.DateField(help_text='Posledn\xed den soust\u0159ed\u011bn\xed', null=True, verbose_name='datum konce', blank=True)),
('verejne_db', models.BooleanField(default=False, verbose_name='soust\u0159ed\u011bn\xed zve\u0159ejn\u011bno', db_column=b'verejne')),
('misto', models.CharField(default=b'', help_text='M\xedsto (n\xe1zev obce, voliteln\u011b t\xe9\u017e objektu', max_length=256, verbose_name='m\xedsto soust\u0159ed\u011bn\xed', blank=True)),
('rocnik', models.ForeignKey(related_name='soustredeni', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik')),
('ucastnici', models.ManyToManyField(help_text='Seznam \xfa\u010dastn\xedk\u016f soust\u0159ed\u011bn\xed', to='seminar.Resitel', db_table=b'seminar_soustredeni_ucastnici', verbose_name='\xfa\u010dastn\xedci soust\u0159ed\u011bn\xed')),
],
options={
'ordering': ['rocnik__rocnik', 'datum_zacatku'],
'db_table': 'seminar_soustredeni',
'verbose_name': 'Soust\u0159ed\u011bn\xed',
'verbose_name_plural': 'Soust\u0159ed\u011bn\xed',
},
bases=(models.Model,),
),
migrations.AddField( migrations.AddField(
model_name='resitel', model_name='resitel',
name='skola', name='skola',
@ -194,7 +245,7 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='cislo', model_name='cislo',
name='rocnik', name='rocnik',
field=models.ForeignKey(verbose_name='ro\u010dn\xedk', to='seminar.Rocnik'), field=models.ForeignKey(related_name='cisla', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik'),
preserve_default=True, preserve_default=True,
), ),
] ]

71
seminar/migrations/0003_auto_20150511_0947.py

@ -1,71 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('seminar', '0002_add_body_views'),
]
operations = [
migrations.CreateModel(
name='VysledkyKCislu',
fields=[
('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column=b'id')),
('body', models.IntegerField(verbose_name='body za \u010d\xedslo', db_column=b'body')),
('body_celkem', models.IntegerField(verbose_name='body celkem do \u010d\xedsla', db_column=b'body_celkem')),
],
options={
'abstract': False,
'db_table': 'seminar_body_k_cislu',
'managed': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='VysledkyZaCislo',
fields=[
('dummy_id', models.CharField(max_length=32, serialize=False, verbose_name='dummy ID pro view', primary_key=True, db_column=b'id')),
('body', models.IntegerField(verbose_name='body za \u010d\xedslo', db_column=b'body')),
],
options={
'abstract': False,
'db_table': 'seminar_body_za_cislo',
'managed': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Soustredeni',
fields=[
('id', models.AutoField(serialize=False, primary_key=True)),
('datum_zacatku', models.DateField(help_text='Prvn\xed den soust\u0159ed\u011bn\xed', null=True, verbose_name='datum za\u010d\xe1tku', blank=True)),
('datum_konce', models.DateField(help_text='Posledn\xed den soust\u0159ed\u011bn\xed', null=True, verbose_name='datum konce', blank=True)),
('misto', models.CharField(default=b'', help_text='M\xedsto (n\xe1zev obce, voliteln\u011b t\xe9\u017e objektu', max_length=256, verbose_name='m\xedsto soust\u0159ed\u011bn\xed', blank=True)),
('rocnik', models.ForeignKey(related_name='soustredeni', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik')),
('ucastnici', models.ManyToManyField(help_text='Seznam \xfa\u010dastn\xedk\u016f soust\u0159ed\u011bn\xed', to='seminar.Resitel', db_table=b'seminar_soustredeni_ucastnici', verbose_name='\xfa\u010dastn\xedci soust\u0159ed\u011bn\xed')),
],
options={
'ordering': ['rocnik__rocnik', 'datum_zacatku'],
'db_table': 'seminar_soustredeni',
'verbose_name': 'Soust\u0159ed\u011bn\xed',
'verbose_name_plural': 'Soust\u0159ed\u011bn\xed',
},
bases=(models.Model,),
),
migrations.AlterField(
model_name='cislo',
name='cislo',
field=models.CharField(help_text='V\u011bt\u0161inou jen "1", vyj\xedme\u010dn\u011b "7-8", lexikograficky ur\u010dije po\u0159ad\xed v ro\u010dn\xedku!', max_length=32, verbose_name='n\xe1zev \u010d\xedsla'),
preserve_default=True,
),
migrations.AlterField(
model_name='cislo',
name='rocnik',
field=models.ForeignKey(related_name='cisla', verbose_name='ro\u010dn\xedk', to='seminar.Rocnik'),
preserve_default=True,
),
]

38
seminar/migrations/0004_auto_20150511_1215.py

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('seminar', '0003_auto_20150511_0947'),
]
operations = [
migrations.AddField(
model_name='cislo',
name='verejne_db',
field=models.BooleanField(default=False, verbose_name='\u010d\xedslo zve\u0159ejn\u011bno', db_column=b'verejne'),
preserve_default=True,
),
migrations.AddField(
model_name='reseni',
name='poznamka',
field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161en\xed (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='resitel',
name='poznamka',
field=models.TextField(help_text='Neve\u0159ejn\xe1 pozn\xe1mka k \u0159e\u0161iteli (plain text)', verbose_name='neve\u0159ejn\xe1 pozn\xe1mka', blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='soustredeni',
name='verejne_db',
field=models.BooleanField(default=False, verbose_name='soust\u0159ed\u011bn\xed zve\u0159ejn\u011bno', db_column=b'verejne'),
preserve_default=True,
),
]

22
seminar/models.py

@ -15,6 +15,8 @@ from django.core.urlresolvers import reverse
from django_countries.fields import CountryField from django_countries.fields import CountryField
from solo.models import SingletonModel from solo.models import SingletonModel
import reversion
from seminar.utils import roman from seminar.utils import roman
# TODO společná báze (admin url, url, veřejné, ...) # TODO společná báze (admin url, url, veřejné, ...)
@ -44,6 +46,7 @@ class SeminarModelBase(models.Model):
# viz https://ovvp.mff.cuni.cz/wiki/aesop/export-skol. # viz https://ovvp.mff.cuni.cz/wiki/aesop/export-skol.
# #
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Skola(SeminarModelBase): class Skola(SeminarModelBase):
@ -85,10 +88,14 @@ class Skola(SeminarModelBase):
stat = CountryField(u'stát', default='CZ', stat = CountryField(u'stát', default='CZ',
help_text=u'ISO 3166-1 kód zeme velkými písmeny (CZ, SK, ...)') help_text=u'ISO 3166-1 kód zeme velkými písmeny (CZ, SK, ...)')
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
help_text=u'Neveřejná poznámka ke škole (plain text)')
def __str__(self): def __str__(self):
return force_unicode(u'%s, %s' % (self.nazev, self.mesto)) return force_unicode(u'%s, %s' % (self.nazev, self.mesto))
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Resitel(SeminarModelBase): class Resitel(SeminarModelBase):
@ -165,6 +172,7 @@ class Resitel(SeminarModelBase):
return force_unicode(self.plne_jmeno()) return force_unicode(self.plne_jmeno())
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Rocnik(SeminarModelBase): class Rocnik(SeminarModelBase):
@ -209,6 +217,7 @@ class Rocnik(SeminarModelBase):
return reverse('seminar_rocnik', kwargs={'pk': self.id}) return reverse('seminar_rocnik', kwargs={'pk': self.id})
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Cislo(SeminarModelBase): class Cislo(SeminarModelBase):
@ -248,6 +257,7 @@ class Cislo(SeminarModelBase):
return reverse('seminar_cislo', kwargs={'pk': self.id}) return reverse('seminar_cislo', kwargs={'pk': self.id})
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Problem(SeminarModelBase): class Problem(SeminarModelBase):
@ -322,6 +332,7 @@ class Problem(SeminarModelBase):
return reverse('seminar_problem', kwargs={'pk': self.id}) return reverse('seminar_problem', kwargs={'pk': self.id})
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Reseni(SeminarModelBase): class Reseni(SeminarModelBase):
@ -361,6 +372,7 @@ def generate_filename(self, filename):
return os.path.join(settings.SEMINAR_RESENI_DIRNAME, datedir, fname) return os.path.join(settings.SEMINAR_RESENI_DIRNAME, datedir, fname)
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class PrilohaReseni(SeminarModelBase): class PrilohaReseni(SeminarModelBase):
@ -379,10 +391,14 @@ class PrilohaReseni(SeminarModelBase):
soubor = models.FileField(u'soubor', upload_to = generate_filename) soubor = models.FileField(u'soubor', upload_to = generate_filename)
poznamka = models.TextField(u'neveřejná poznámka', blank=True,
help_text=u'Neveřejná poznámka k příloze řešení (plain text), např. o původu')
def __str__(self): def __str__(self):
return force_unicode(self.soubor) return force_unicode(self.soubor)
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Soustredeni(SeminarModelBase): class Soustredeni(SeminarModelBase):
@ -420,6 +436,8 @@ class Soustredeni(SeminarModelBase):
def verejne_url(self): def verejne_url(self):
return reverse('seminar_soustredeni', kwargs={'pk': self.id}) return reverse('seminar_soustredeni', kwargs={'pk': self.id})
@python_2_unicode_compatible
class VysledkyBase(SeminarModelBase): class VysledkyBase(SeminarModelBase):
class Meta: class Meta:
@ -437,6 +455,8 @@ class VysledkyBase(SeminarModelBase):
body = models.IntegerField(u'body za číslo', db_column='body') body = models.IntegerField(u'body za číslo', db_column='body')
def __str__(self):
return force_unicode(u"%s: %sb (%s)" % (self.resitel.plne_jmeno(), self.body, str(self.cislo)))
@python_2_unicode_compatible @python_2_unicode_compatible
class VysledkyZaCislo(VysledkyBase): class VysledkyZaCislo(VysledkyBase):
@ -449,6 +469,7 @@ class VysledkyZaCislo(VysledkyBase):
def __str__(self): def __str__(self):
return force_unicode(u"%s: %sb (za %s)" % (self.resitel.plne_jmeno(), self.body, str(self.cislo))) return force_unicode(u"%s: %sb (za %s)" % (self.resitel.plne_jmeno(), self.body, str(self.cislo)))
@python_2_unicode_compatible @python_2_unicode_compatible
class VysledkyKCislu(VysledkyBase): class VysledkyKCislu(VysledkyBase):
@ -463,6 +484,7 @@ class VysledkyKCislu(VysledkyBase):
return force_unicode(u"%s: %sb / %sb (do %s)" % (self.resitel.plne_jmeno(), self.body, self.body_celkem, str(self.cislo))) return force_unicode(u"%s: %sb / %sb (do %s)" % (self.resitel.plne_jmeno(), self.body, self.body_celkem, str(self.cislo)))
@reversion.register(ignore_duplicate_revisions=True)
@python_2_unicode_compatible @python_2_unicode_compatible
class Nastaveni(SingletonModel): class Nastaveni(SingletonModel):

Loading…
Cancel
Save