From f480dee1c0318c739ec06e6796718bc7bd281f77 Mon Sep 17 00:00:00 2001
From: Jorran de Wit <jorrandewit@outlook.com>
Date: Thu, 28 Sep 2017 20:17:03 +0200
Subject: [PATCH] Fix migrations typo

---
 production/migrations/0015_auto_20170914_2237.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/production/migrations/0015_auto_20170914_2237.py b/production/migrations/0015_auto_20170914_2237.py
index adb4fcbfb..cb9ffcc83 100644
--- a/production/migrations/0015_auto_20170914_2237.py
+++ b/production/migrations/0015_auto_20170914_2237.py
@@ -11,13 +11,13 @@ def contributor_to_officer(apps, schema_editor):
     ProductionUser = apps.get_model('production', 'ProductionUser')
     officers = Group.objects.get(name='Production Officers')
     for user in officers.user_set.all():
-        ProductionUser.objects.get_or_create(user__id=user.id)
+        ProductionUser.objects.get_or_create(user_id=user.id)
     print('\n  - Production Officers transfered to ProductionUser')
 
     # Transfer all Events
     ProductionEvent = apps.get_model('production', 'ProductionEvent')
     for event in ProductionEvent.objects.all():
-        user = User.objects.get(contributor__id=event.noted_by_contributor.id)
+        user = User.objects.get(contributor__id=event.noted_by_contributor.id, production_user__isnull=False)
         event.noted_by.id = user.production_user.id
         event.save()
     print('  - ProductionEvents updated')
@@ -29,7 +29,7 @@ def officer_to_contributor(apps, schema_editor):
     # Transfer all Events
     ProductionEvent = apps.get_model('production', 'ProductionEvent')
     for event in ProductionEvent.objects.all():
-        user = User.objects.get(production_user__id=event.noted_by.id)
+        user = User.objects.get(production_user_id=event.noted_by.id)
         event.noted_by_contributor.id = user.contributor.id
         event.save()
     print('\n  - ProductionEvents updated')
-- 
GitLab