Jonas Havelka
4 years ago
2 changed files with 33 additions and 1 deletions
@ -0,0 +1,32 @@ |
|||||
|
# Generated by Django 2.2.13 on 2020-06-24 22:57 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
def smaz_prezdivku(apps, schema_editor): |
||||
|
Osoba = apps.get_model('seminar', 'Osoba') |
||||
|
|
||||
|
for o in Osoba.objects.filter(prezdivka=''): |
||||
|
o.prezdivka = None |
||||
|
o.save() |
||||
|
|
||||
|
def pridej_prezdivku(apps, schema_editor): |
||||
|
Osoba = apps.get_model('seminar', 'Osoba') |
||||
|
|
||||
|
for o in Osoba.objects.filter(prezdivka=None): |
||||
|
o.prezdivka = '' |
||||
|
o.save() |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('seminar', '0084_clanek_cislo'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.AlterField( |
||||
|
model_name='osoba', |
||||
|
name='prezdivka', |
||||
|
field=models.CharField(blank=True, max_length=256, null=True, verbose_name='přezdívka'), |
||||
|
), |
||||
|
migrations.RunPython(smaz_prezdivku, pridej_prezdivku), |
||||
|
] |
Loading…
Reference in new issue