|
@ -114,7 +114,7 @@ def Clanek_Treenody(apps, schema_editor): |
|
|
TextNode = apps.get_model('seminar', 'TextNode') |
|
|
TextNode = apps.get_model('seminar', 'TextNode') |
|
|
for cl in Clanek.objects.all(): |
|
|
for cl in Clanek.objects.all(): |
|
|
# Vyrobíme nody: |
|
|
# Vyrobíme nody: |
|
|
# Clanek nema vlastni node, ma (prave jedno) Reseni a to ma ReseniNode |
|
|
# Clanek nema vlastni node, ma (prave jedno) Reseni a to ma text_cely -- ReseniNode |
|
|
reseni = cl.reseni_set.all() |
|
|
reseni = cl.reseni_set.all() |
|
|
if len(reseni) != 1: |
|
|
if len(reseni) != 1: |
|
|
raise ValueError(f'Clanek {cl.id} ma vic reseni {len(reseni)} ({reseni})') |
|
|
raise ValueError(f'Clanek {cl.id} ma vic reseni {len(reseni)} ({reseni})') |
|
@ -122,6 +122,8 @@ def Clanek_Treenody(apps, schema_editor): |
|
|
resnode = ReseniNode(reseni=reseni) |
|
|
resnode = ReseniNode(reseni=reseni) |
|
|
poskladej_strom(apps, resnode, cl.text_zadani, cl.text_reseni) |
|
|
poskladej_strom(apps, resnode, cl.text_zadani, cl.text_reseni) |
|
|
resnode.save() |
|
|
resnode.save() |
|
|
|
|
|
reseni.text_cely = resnode |
|
|
|
|
|
reseni.save() |
|
|
|
|
|
|
|
|
def fix_Clanek_Reseni(apps, schema_editor): |
|
|
def fix_Clanek_Reseni(apps, schema_editor): |
|
|
Problem = apps.get_model('seminar', 'Problem') |
|
|
Problem = apps.get_model('seminar', 'Problem') |
|
|