Migrace pohádky (změna typu fieldu)
This commit is contained in:
parent
b16242c5e2
commit
51123d6a12
2 changed files with 27 additions and 5 deletions
22
seminar/migrations/0060_oprav_pohadku.py
Normal file
22
seminar/migrations/0060_oprav_pohadku.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.20 on 2019-05-29 03:26
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
def oprav_pohadku(apps, schema_editor):
|
||||||
|
Pohadka = apps.get_model('seminar', 'Pohadka')
|
||||||
|
|
||||||
|
for p in Pohadka.objects.all():
|
||||||
|
if p.uloha_old:
|
||||||
|
p.uloha = p.uloha_old.uloha # Pokud to nebyla úloha, vyhodí Uloha.DoesNotExists výjimku.
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('seminar', '0059_spoj_stromy'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(oprav_pohadku),
|
||||||
|
]
|
|
@ -10,7 +10,7 @@ import django.utils.timezone
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('seminar', '0059_spoj_stromy'),
|
('seminar', '0060_oprav_pohadku'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -42,10 +42,10 @@ class Migration(migrations.Migration):
|
||||||
model_name='pohadka',
|
model_name='pohadka',
|
||||||
name='autor_old',
|
name='autor_old',
|
||||||
),
|
),
|
||||||
# migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
# model_name='pohadka',
|
model_name='pohadka',
|
||||||
# name='uloha_old',
|
name='uloha_old',
|
||||||
# ),
|
),
|
||||||
migrations.RemoveField(
|
migrations.RemoveField(
|
||||||
model_name='problem',
|
model_name='problem',
|
||||||
name='autor_old',
|
name='autor_old',
|
Loading…
Reference in a new issue