From 54e728d2be2ce6b25d4f0e8cc196f0acb8c14d80 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Thu, 20 Aug 2020 00:40:50 +0200 Subject: [PATCH] =?UTF-8?q?A=20nakonec=20to=20stejn=C4=9B=20SQL=20je...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/migrations/fix_0058.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/seminar/migrations/fix_0058.py b/seminar/migrations/fix_0058.py index e344d237..ac36d0a0 100644 --- a/seminar/migrations/fix_0058.py +++ b/seminar/migrations/fix_0058.py @@ -1,11 +1,6 @@ from django.db import migrations -def oprav_ulohy(apps, schema_editor): - Problem = apps.get_model('seminar', 'Pohadka') - - for p in Problem.objects.filter(typ="b'uloha'"): - p.typ = "uloha" - p.save() +sql = "update seminar_problemy set typ = 'uloha' where typ like 'b_uloha_';" class Migration(migrations.Migration): @@ -14,6 +9,6 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunPython(oprav_ulohy, oprav_ulohy), + migrations.RunSQL(sql, sql), ]