0018_auto_20160704_1017.py 656 B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.db import migrations, models
  4. def fill_email_ldap(apps, schema_editor):
  5. Person = apps.get_model("backend", "Person")
  6. #robot = Person.objects.get(username="__housekeeping__")
  7. for person in Person.objects.all():
  8. person.email_ldap = person.email
  9. person.save()
  10. #person.save(audit_notes="Initialized email_ldap from existing email field", audit_author=robot)
  11. class Migration(migrations.Migration):
  12. dependencies = [
  13. ('backend', '0017_person_email_ldap'),
  14. ]
  15. operations = [
  16. migrations.RunPython(fill_email_ldap),
  17. ]