mamweb/seminar/migrations/0073_copy_osoba_email_to_user_email.py

23 lines
478 B
Python
Raw Normal View History

# Generated by Django 2.2.9 on 2020-01-15 21:28
from django.db import migrations
def copy_mails(apps, schema_editor):
Osoba = apps.get_model('seminar', 'Osoba')
for o in Osoba.objects.all():
if o.user is not None:
u = o.user
u.email = o.email
u.save()
class Migration(migrations.Migration):
dependencies = [
('seminar', '0072_auto_20191204_2257'),
]
operations = [
migrations.RunPython(copy_mails, migrations.RunPython.noop)
]