# -*- 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

def reseni_to_Reseni(apps, schema_editor): 
	Reseni = apps.get_model('seminar','Reseni')
	Reseni_Resitele = apps.get_model('seminar','Reseni_Resitele')
	Hodnoceni = apps.get_model('seminar','Hodnoceni')
	
	for r in Reseni.objects.all():
		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)
	

class Migration(migrations.Migration):

	dependencies = [
		('seminar', '0056_vrcholy_pro_rocniky_a_cisla'),
	]

	operations = [
		migrations.RunPython(reseni_to_Reseni, migrations.RunPython.noop)
	]