|
|
@ -5,7 +5,7 @@ import random |
|
|
|
import django.contrib.auth |
|
|
|
from django.db import transaction |
|
|
|
|
|
|
|
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni |
|
|
|
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici |
|
|
|
|
|
|
|
from django.contrib.flatpages.models import FlatPage |
|
|
|
from django.contrib.sites.models import Site |
|
|
@ -70,7 +70,7 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
for ci in range(1, cisel + 1): |
|
|
|
vydano = datetime.date(r.prvni_rok, ci + 6, 1) |
|
|
|
deadline = datetime.date(r.prvni_rok, ci + 8, 1) if ci + 2 < cisel else None |
|
|
|
c = Cislo.objects.create(rocnik = r, cislo = str(ci), datum_vydani=vydano, datum_deadline=deadline) |
|
|
|
c = Cislo.objects.create(rocnik = r, cislo = str(ci), datum_vydani=vydano, datum_deadline=deadline, verejne_db=True) |
|
|
|
cs[ci] = c |
|
|
|
|
|
|
|
# problemy resene v ci |
|
|
@ -91,6 +91,12 @@ def create_test_data(size = 6, rnd = None): |
|
|
|
res = Reseni.objects.create(problem = p, resitel = resitel, |
|
|
|
body = rnd.randint(0, p.body), cislo_body = cs[ci]) |
|
|
|
|
|
|
|
sous = Soustredeni.objects.create(rocnik=Rocnik.objects.first(), verejne_db=True, misto=u'Někde', |
|
|
|
datum_zacatku=datetime.date(2000, 11, 23), datum_konce=datetime.date(2000, 11, 27)) |
|
|
|
for res in rnd.sample(resitele, 6): |
|
|
|
Soustredeni_Ucastnici.objects.create(resitel=res, soustredeni=sous) |
|
|
|
sous.save() |
|
|
|
|
|
|
|
nastaveni = Nastaveni.objects.create(aktualni_rocnik = Rocnik.objects.last(), |
|
|
|
aktualni_cislo = Cislo.objects.all()[1]) |
|
|
|
|
|
|
|