From 51123d6a12f981b9be82aa9cca893a4458e400e5 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Wed, 29 May 2019 17:42:54 +0200 Subject: [PATCH] =?UTF-8?q?Migrace=20poh=C3=A1dky=20(zm=C4=9Bna=20typu=20f?= =?UTF-8?q?ieldu)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/migrations/0060_oprav_pohadku.py | 22 +++++++++++++++++++ ...nkenstein.py => 0061_kill_frankenstein.py} | 10 ++++----- 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 seminar/migrations/0060_oprav_pohadku.py rename seminar/migrations/{0060_kill_frankenstein.py => 0061_kill_frankenstein.py} (97%) diff --git a/seminar/migrations/0060_oprav_pohadku.py b/seminar/migrations/0060_oprav_pohadku.py new file mode 100644 index 00000000..87fd15cf --- /dev/null +++ b/seminar/migrations/0060_oprav_pohadku.py @@ -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), + ] diff --git a/seminar/migrations/0060_kill_frankenstein.py b/seminar/migrations/0061_kill_frankenstein.py similarity index 97% rename from seminar/migrations/0060_kill_frankenstein.py rename to seminar/migrations/0061_kill_frankenstein.py index 7312fe38..14026382 100644 --- a/seminar/migrations/0060_kill_frankenstein.py +++ b/seminar/migrations/0061_kill_frankenstein.py @@ -10,7 +10,7 @@ import django.utils.timezone class Migration(migrations.Migration): dependencies = [ - ('seminar', '0059_spoj_stromy'), + ('seminar', '0060_oprav_pohadku'), ] operations = [ @@ -42,10 +42,10 @@ class Migration(migrations.Migration): model_name='pohadka', name='autor_old', ), -# migrations.RemoveField( -# model_name='pohadka', -# name='uloha_old', -# ), + migrations.RemoveField( + model_name='pohadka', + name='uloha_old', + ), migrations.RemoveField( model_name='problem', name='autor_old',