diff --git a/seminar/migrations/0005_alter_problem_autor.py b/seminar/migrations/0005_alter_problem_autor.py new file mode 100644 index 00000000..264e9848 --- /dev/null +++ b/seminar/migrations/0005_alter_problem_autor.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0004_add_old_dakos_id'), + ] + + operations = [ + migrations.AlterField( + model_name='problem', + name='autor', + field=models.ForeignKey(related_name='autor_uloh', verbose_name='autor probl\xe9mu', blank=True, to=settings.AUTH_USER_MODEL, null=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0006_problem_add_timestamp.py b/seminar/migrations/0006_problem_add_timestamp.py new file mode 100644 index 00000000..3df8bfdb --- /dev/null +++ b/seminar/migrations/0006_problem_add_timestamp.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import datetime +from django.utils.timezone import utc + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0005_alter_problem_autor'), + ] + + operations = [ + migrations.AddField( + model_name='problem', + name='timestamp', + field=models.DateTimeField(default=datetime.datetime(2015, 5, 15, 8, 54, 56, 319985, tzinfo=utc), verbose_name='vytvo\u0159eno', auto_now=True), + preserve_default=False, + ), + migrations.AlterField( + model_name='problem', + name='dakos_id', + field=models.CharField(default=b'', help_text='DaKoS ID z exportu, s prefixem podle p\u016fvodu: "AZAD:xxx (z MM_AZAD), ""DOZ:xxx" (z MM_DOZ), "ZAD:rocnik.cislo.uloha.typ" (z MM_ZADANIA)', max_length=32, verbose_name='Star\xe9 DaKoS ID', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/models.py b/seminar/models.py index 73b52090..a153bc38 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -314,7 +314,7 @@ class Problem(SeminarModelBase): text_problemu = models.TextField(u'veřejný text zadání a řešení', blank=True) - autor = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'autor problému', related_name='autor_uloh') + autor = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'autor problému', related_name='autor_uloh', null=True, blank=True) opravovatel = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'opravovatel', null=True, blank=True, related_name='opravovatel_uloh') @@ -329,9 +329,12 @@ class Problem(SeminarModelBase): body = models.IntegerField(u'maximum bodů', blank=True, null=True) + timestamp = models.DateTimeField(u'vytvořeno', auto_now=True) + # Staré ID z DAKOSU -- jen u importovaných záznamů dakos_id = models.CharField(u'Staré DaKoS ID', max_length=32, blank=True, default='', - help_text=u'DaKoS ID z exportu, s prefixem podle původu: "AZAD:xxx" (z MM_AZAD), "DOZ:xxx" (z MM_DOZ), "ZAD:xxx" (z MM_ZADANIA)') + help_text=(u'DaKoS ID z exportu, s prefixem podle původu: "AZAD:xxx (z MM_AZAD), "' + + u'"DOZ:xxx" (z MM_DOZ), "ZAD:rocnik.cislo.uloha.typ" (z MM_ZADANIA)')) def __str__(self): return force_unicode(u'%s (%s)' % (self.nazev, self.stav)) @@ -469,9 +472,9 @@ class VysledkyBase(SeminarModelBase): dummy_id = models.CharField(u'dummy ID pro view', max_length=32, primary_key=True, db_column='id') - cislo = models.ForeignKey(Cislo, verbose_name=u'číslo pro body', db_column='cislo_id') + cislo = models.ForeignKey(Cislo, verbose_name=u'číslo pro body', db_column='cislo_id', on_delete=models.DO_NOTHING) - resitel = models.ForeignKey(Resitel, verbose_name=u'řešitel', db_column='resitel_id') + resitel = models.ForeignKey(Resitel, verbose_name=u'řešitel', db_column='resitel_id', on_delete=models.DO_NOTHING) body = models.IntegerField(u'body za číslo', db_column='body')