|
@ -3,7 +3,6 @@ |
|
|
import datetime |
|
|
import datetime |
|
|
from django.db import migrations, models |
|
|
from django.db import migrations, models |
|
|
import django.db.models.deletion |
|
|
import django.db.models.deletion |
|
|
from django.db.models import F |
|
|
|
|
|
from django.utils import timezone |
|
|
from django.utils import timezone |
|
|
|
|
|
|
|
|
import seminar.models as m |
|
|
import seminar.models as m |
|
@ -15,44 +14,44 @@ def vytvor_deadliny(apps, schema_editor): |
|
|
|
|
|
|
|
|
for cislo in Cislo.objects.all(): |
|
|
for cislo in Cislo.objects.all(): |
|
|
if cislo.rocnik.rocnik < 26: |
|
|
if cislo.rocnik.rocnik < 26: |
|
|
d = Deadline() |
|
|
Deadline.objects.create( |
|
|
d.cislo = cislo |
|
|
cislo=cislo, |
|
|
d.typ = m.Deadline.TYP_CISLA |
|
|
typ=m.Deadline.TYP_CISLA, |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(datetime.date(1994 + cislo.rocnik.rocnik, 6, int(cislo.poradi[0])), datetime.time.min)) |
|
|
deadline=timezone.make_aware(datetime.datetime.combine(datetime.date(1994 + cislo.rocnik.rocnik, 6, int(cislo.poradi[0])), datetime.time.min)), |
|
|
d.verejna_vysledkovka = cislo.verejna_vysledkovka |
|
|
verejna_vysledkovka=cislo.verejna_vysledkovka, |
|
|
d.save() |
|
|
) |
|
|
continue |
|
|
continue |
|
|
|
|
|
|
|
|
|
|
|
def vytvor_deadline(date: datetime.date, typ): |
|
|
|
|
|
Deadline.objects.create( |
|
|
|
|
|
cislo=cislo, |
|
|
|
|
|
typ=typ, |
|
|
|
|
|
deadline=timezone.make_aware(datetime.datetime.combine(date, datetime.time.min)) + datetime.timedelta(days=1), |
|
|
|
|
|
verejna_vysledkovka=True |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
if cislo.datum_deadline_soustredeni and cislo.datum_deadline_soustredeni == cislo.datum_preddeadline: |
|
|
if cislo.datum_deadline_soustredeni and cislo.datum_deadline_soustredeni == cislo.datum_preddeadline: |
|
|
d = Deadline() |
|
|
vytvor_deadline( |
|
|
d.cislo = cislo |
|
|
date=cislo.datum_deadline_soustredeni, |
|
|
d.typ = m.Deadline.TYP_PRVNI_A_SOUS |
|
|
typ=m.Deadline.TYP_PRVNI_A_SOUS |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline_soustredeni, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
) |
|
|
d.verejna_vysledkovka = True |
|
|
|
|
|
d.save() |
|
|
|
|
|
else: |
|
|
else: |
|
|
if cislo.datum_deadline_soustredeni: |
|
|
if cislo.datum_deadline_soustredeni: |
|
|
d = Deadline() |
|
|
vytvor_deadline( |
|
|
d.cislo = cislo |
|
|
date=cislo.datum_deadline_soustredeni, |
|
|
d.typ = m.Deadline.TYP_SOUS |
|
|
typ=m.Deadline.TYP_SOUS |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline_soustredeni, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
) |
|
|
d.verejna_vysledkovka = True |
|
|
|
|
|
d.save() |
|
|
|
|
|
if cislo.datum_preddeadline: |
|
|
if cislo.datum_preddeadline: |
|
|
d = Deadline() |
|
|
vytvor_deadline( |
|
|
d.cislo = cislo |
|
|
date=cislo.datum_preddeadline, |
|
|
d.typ = m.Deadline.TYP_PRVNI |
|
|
typ=m.Deadline.TYP_PRVNI |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_preddeadline, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
) |
|
|
d.verejna_vysledkovka = True |
|
|
|
|
|
d.save() |
|
|
|
|
|
|
|
|
|
|
|
if cislo.datum_deadline: |
|
|
if cislo.datum_deadline: |
|
|
d = Deadline() |
|
|
vytvor_deadline( |
|
|
d.cislo = cislo |
|
|
date=cislo.datum_deadline, |
|
|
d.typ = m.Deadline.TYP_CISLA |
|
|
typ=m.Deadline.TYP_CISLA |
|
|
d.deadline = timezone.make_aware(datetime.datetime.combine(cislo.datum_deadline, datetime.time.min)) + datetime.timedelta(days=1) |
|
|
) |
|
|
d.verejna_vysledkovka = True |
|
|
|
|
|
d.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration): |
|
|
class Migration(migrations.Migration): |
|
|