with transaction.atomic(): assert t.id == 2365 pfx = f"{t.nazev}, " # Problémy for k, b in [(4,3)]: u = m.Uloha.objects.create( nadproblem=t, nazev=pfx + f"{'úloha' if b is not None else 'problém'} {k}", autor=t.autor, garant=t.garant, max_body=b, cislo_zadani=m.Cislo.get(28, 5), kod=k, stav=m.Problem.STAV_ZADANY, ) u.opravovatele.set(t.opravovatele.all()) print(u, u.max_body) input("rly?")