Browse Source

A nakonec to stejně SQL je...

middleware_test
Pavel "LEdoian" Turinsky 4 years ago
parent
commit
54e728d2be
  1. 9
      seminar/migrations/fix_0058.py

9
seminar/migrations/fix_0058.py

@ -1,11 +1,6 @@
from django.db import migrations from django.db import migrations
def oprav_ulohy(apps, schema_editor): sql = "update seminar_problemy set typ = 'uloha' where typ like 'b_uloha_';"
Problem = apps.get_model('seminar', 'Pohadka')
for p in Problem.objects.filter(typ="b'uloha'"):
p.typ = "uloha"
p.save()
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -14,6 +9,6 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(oprav_ulohy, oprav_ulohy), migrations.RunSQL(sql, sql),
] ]

Loading…
Cancel
Save