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',
|
||||
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(
|
||||
name='TreeNode',
|
||||
fields=[
|
||||
|
|
|
@ -48,7 +48,7 @@ def resitel_to_osoba(apps,schema_editor):
|
|||
elif o.email == u.email:
|
||||
u.email = 'Použij osobu!'
|
||||
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()
|
||||
|
||||
|
||||
|
|
|
@ -6,16 +6,21 @@ 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():
|
||||
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()
|
||||
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):
|
||||
|
|
Loading…
Reference in a new issue