mamweb/seminar/migrations/0057_reseni_to_reseni_hodnoceni.py

35 lines
862 B
Python
Raw Normal View History

2019-05-28 23:47:20 +02:00
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-28 21:46
from __future__ import unicode_literals
from django.db import migrations
2019-05-29 00:27:03 +02:00
def reseni_to_Reseni(apps, schema_editor):
Reseni = apps.get_model('seminar','Reseni')
2019-05-29 01:54:05 +02:00
Reseni_Resitele = apps.get_model('seminar','Reseni_Resitele')
2019-05-29 00:27:03 +02:00
Hodnoceni = apps.get_model('seminar','Hodnoceni')
for r in Reseni.objects.all():
2019-05-29 01:54:05 +02:00
rr = Reseni_Resitele.objects.create(resitele = r.resitel, reseni=r)
if r.body == None:
print("!!!!!!!!!!!!!!!")
print(r.id,r)
print("!!!!!!!!!!!!!!!")
else:
h = Hodnoceni.objects.create(
body=r.body,
cislo_body = r.cislo_body,
problem = r.problem_old,
reseni = r)
2019-05-29 00:27:03 +02:00
2019-05-28 23:47:20 +02:00
class Migration(migrations.Migration):
2019-05-29 00:27:03 +02:00
dependencies = [
('seminar', '0056_vrcholy_pro_rocniky_a_cisla'),
]
2019-05-28 23:47:20 +02:00
2019-05-29 00:27:03 +02:00
operations = [
migrations.RunPython(reseni_to_Reseni)
]