|
@ -4,6 +4,19 @@ from __future__ import unicode_literals |
|
|
|
|
|
|
|
|
from django.db import migrations |
|
|
from django.db import migrations |
|
|
|
|
|
|
|
|
|
|
|
def reseni_to_Reseni(apps, schema_editor): |
|
|
|
|
|
Reseni = apps.get_model('seminar','Reseni') |
|
|
|
|
|
Hodnoceni = apps.get_model('seminar','Hodnoceni') |
|
|
|
|
|
|
|
|
|
|
|
for r in Reseni.objects.all(): |
|
|
|
|
|
r.resitele.add(r.resitel) |
|
|
|
|
|
h = Hodnoceni.objects.create(body=r.body) |
|
|
|
|
|
h.cislo_body = r.cislo_body |
|
|
|
|
|
h.problem = r.problem |
|
|
|
|
|
h.reseni = r |
|
|
|
|
|
h.save() |
|
|
|
|
|
r.save() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration): |
|
|
class Migration(migrations.Migration): |
|
|
|
|
|
|
|
@ -12,4 +25,5 @@ class Migration(migrations.Migration): |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
operations = [ |
|
|
operations = [ |
|
|
|
|
|
migrations.RunPython(reseni_to_Reseni) |
|
|
] |
|
|
] |
|
|