Skip to content
Snippets Groups Projects
Commit 63ce533f authored by Ben Adida's avatar Ben Adida
Browse files

tweaked migration to be more efficient

parent 7c6d8978
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,9 @@ class Migration(DataMigration):
e.datatype = 'legacy/Election'
e.save()
for v in orm.Voter.objects.all():
# use the .iterator() call to reduce caching and make this more efficient
# so as not to trigger a memory error
for v in orm.Voter.objects.all().iterator():
user = orm['auth.User'].objects.get(user_type = v.voter_type, user_id = v.voter_id)
if v.voter_type == 'password':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment