Bugfixy v migracich.
This commit is contained in:
parent
5809dc899b
commit
517b06bcda
3 changed files with 13 additions and 18 deletions
|
@ -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=[
|
||||||
|
|
|
@ -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()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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…
Reference in a new issue