Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
[Bug 1351853] Fix Netherlands geo_country migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
johngian committed Mar 31, 2017
1 parent bbc3ae0 commit 0f8444c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions mozillians/users/migrations/0016_auto_20170331_0812.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations


def migrate_countries(apps, schema_editor):
Country = apps.get_model('cities_light', 'Country')
UserProfile = apps.get_model('users', 'UserProfile')

try:
qs = UserProfile.objects.filter(geo_country__name='Netherlands')
country = Country.objects.get(name='Netherlands')
kwargs = {
'country': country,
}
qs.update(**kwargs)
except:
pass


def backwards(apps, schema_editor):
pass


class Migration(migrations.Migration):

dependencies = [
('users', '0015_auto_20170323_1202'),
]

operations = [
migrations.RunPython(migrate_countries, backwards),
]

0 comments on commit 0f8444c

Please sign in to comment.