Browse Source

Bugfixy v migracich.

export_seznamu_prednasek
parent
commit
517b06bcda
  1. 10
      seminar/migrations/0050_auto_20190510_2228.py
  2. 2
      seminar/migrations/0051_resitel_to_osoba.py
  3. 19
      seminar/migrations/0057_reseni_to_reseni_hodnoceni.py

10
seminar/migrations/0050_auto_20190510_2228.py

@ -33,16 +33,6 @@ class Migration(migrations.Migration):
name='osoba', name='osoba',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='osoba'), field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='seminar.Osoba', verbose_name='osoba'),
), ),
migrations.AlterField(
model_name='uloha',
name='vzorak',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='uloha_vzorak_set', to='seminar.Text', verbose_name='vzorové řešení'),
),
migrations.AlterField(
model_name='uloha',
name='zadani',
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='uloha_zadani_set', to='seminar.Text', verbose_name='veřejné zadání'),
),
migrations.CreateModel( migrations.CreateModel(
name='TreeNode', name='TreeNode',
fields=[ fields=[

2
seminar/migrations/0051_resitel_to_osoba.py

@ -48,7 +48,7 @@ def resitel_to_osoba(apps,schema_editor):
elif o.email == u.email: elif o.email == u.email:
u.email = 'Použij osobu!' u.email = 'Použij osobu!'
else: else:
raise ValueError('o.email a u.email rozdílné: "{}" vs. "{}"'.format(o.email, u.first_name)) raise ValueError('o.email a u.email rozdílné: "{}" vs. "{}"'.format(o.email, u.email))
u.save() u.save()

19
seminar/migrations/0057_reseni_to_reseni_hodnoceni.py

@ -6,16 +6,21 @@ from django.db import migrations
def reseni_to_Reseni(apps, schema_editor): def reseni_to_Reseni(apps, schema_editor):
Reseni = apps.get_model('seminar','Reseni') Reseni = apps.get_model('seminar','Reseni')
Reseni_Resitele = apps.get_model('seminar','Reseni_Resitele')
Hodnoceni = apps.get_model('seminar','Hodnoceni') Hodnoceni = apps.get_model('seminar','Hodnoceni')
for r in Reseni.objects.all(): for r in Reseni.objects.all():
r.resitele.add(r.resitel) rr = Reseni_Resitele.objects.create(resitele = r.resitel, reseni=r)
h = Hodnoceni.objects.create(body=r.body) if r.body == None:
h.cislo_body = r.cislo_body print("!!!!!!!!!!!!!!!")
h.problem = r.problem print(r.id,r)
h.reseni = r print("!!!!!!!!!!!!!!!")
h.save() else:
r.save() h = Hodnoceni.objects.create(
body=r.body,
cislo_body = r.cislo_body,
problem = r.problem_old,
reseni = r)
class Migration(migrations.Migration): class Migration(migrations.Migration):

Loading…
Cancel
Save