Skip to content

Commit

Permalink
Merge pull request #53 from Qabel/m/i52
Browse files Browse the repository at this point in the history
fix PUR denorm migration crashing (safely)
  • Loading branch information
enkore authored Jan 12, 2017
2 parents c430b83 + 3715a3c commit 7f706c7
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
import json

from django.db import migrations, models

Expand All @@ -7,7 +8,10 @@ def denormalize_pur_public_key(apps, schema_editor):
PendingUpdateRequest = apps.get_model('index_service', 'PendingUpdateRequest')

for pur in PendingUpdateRequest.objects.all():
pur.public_key = pur.request['identity']['public_key']
# Make sure to not depend on any code on the model, because models pulled from the ORM
# *only* consist of their field definitions.
request = json.loads(pur._json_request)
pur.public_key = request['identity']['public_key']
pur.save()


Expand Down

0 comments on commit 7f706c7

Please sign in to comment.