Commit 1f714e16 by Martyn James Committed by Xavier Antoviaque

Tweak to migration in order to accomodate old names for data fields and allow…

Tweak to migration in order to accomodate old names for data fields and allow for if data fields were not present
parent e26b8be6
...@@ -16,12 +16,23 @@ class Command(BaseCommand): ...@@ -16,12 +16,23 @@ class Command(BaseCommand):
for org in org_groups: for org in org_groups:
data = json.loads(org.data) data = json.loads(org.data)
name = org.name
display_name = data.get('display_name', name)
contact_name = data.get('contact_name', None)
contact_email = data.get('email', None)
if contact_email is None:
contact_email = data.get('contact_email', None)
contact_phone = data.get('phone', None)
if contact_phone is None:
contact_phone = data.get('contact_phone', None)
migrated_org = Organization.objects.create( migrated_org = Organization.objects.create(
name=data['name'], name=name,
display_name=data['display_name'], display_name=display_name,
contact_name=data['contact_name'], contact_name=contact_name,
contact_email=data['contact_email'], contact_email=contact_email,
contact_phone=data['contact_phone'] contact_phone=contact_phone
) )
group = Group.objects.get(groupprofile=org.id) group = Group.objects.get(groupprofile=org.id)
users = group.user_set.all() users = group.user_set.all()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment