From d57214446d153083174e51518e68f5b5cf09f3a1 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 14 Aug 2019 04:41:12 +0200 Subject: [PATCH] Testdata: Fix CHOICES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v DB byl bordel (celé tuply), nevešly se do postgresového limitu. --- seminar/testutils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seminar/testutils.py b/seminar/testutils.py index f9208280..1068d9f1 100644 --- a/seminar/testutils.py +++ b/seminar/testutils.py @@ -104,7 +104,7 @@ def gen_resitele(rnd, osoby, skoly): if not (rand % 8 == 0): resitele.append(Resitel.objects.create(osoba=os, skola=rnd.choice(skoly), rok_maturity=rnd.randint(2019, 2029), - zasilat=rnd.choice(Resitel.ZASILAT_CHOICES))) + zasilat=rnd.choice(Resitel.ZASILAT_CHOICES)[0])) return resitele def gen_prijemci(rnd, osoby, kolik=10): @@ -218,7 +218,7 @@ def gen_ulohy_do_cisla(rnd, organizatori, resitele, rocnik_cisla, rocniky, size) res_vyber = rnd.sample(resitele, rnd.randint(1, 5)) # problem a resitele přiřadíme později, ManyToManyField # se nedá vyplnit v create() - res = Reseni.objects.create(forma=rnd.choice(Reseni.FORMA_CHOICES)) + res = Reseni.objects.create(forma=rnd.choice(Reseni.FORMA_CHOICES)[0]) #res.save() <- asi smazat res.resitele.set(res_vyber) res.save() @@ -367,7 +367,7 @@ def gen_temata(rnd, rocniky, rocnik_cisla, organizatori): garant=rnd.choice(organizatori), kod=str(n), # atributy třídy Téma - tema_typ=rnd.choice(Tema.TEMA_CHOICES), + tema_typ=rnd.choice(Tema.TEMA_CHOICES)[0], rocnik=rocnik ) konec_tematu = min(rnd.randint(ci, 7), len(cisla))