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

Commit

Permalink
Merge pull request #1679 from johngian/fix-country-url
Browse files Browse the repository at this point in the history
[Fix bug 1351853] Fix country issue
  • Loading branch information
johngian authored Mar 31, 2017
2 parents 089bdeb + 0f8444c commit 2cedf98
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mozillians/phonebook/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
url(r'^betasearch/$', 'views.betasearch', name='betasearch'),
url(r'^invite/$', 'views.invite', name='invite'),
url(r'^invite/(?P<invite_pk>\d+)/delete/$', 'views.delete_invite', name='delete_invite'),
url(r'^country/(?P<country>[A-Za-z0-9 \.]+)/$',
url(r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/$',
'views.list_mozillians_in_location', name='list_country'),
url(r'^country/(?P<country>[A-Za-z0-9 \.]+)/city/(?P<city>.+)/$',
url(r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/city/(?P<city>.+)/$',
'views.list_mozillians_in_location', name='list_city'),
url((r'^country/(?P<country>[A-Za-z0-9 \.]+)/'
url((r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/'
'region/(?P<region>.+)/city/(?P<city>.+)/$'),
'views.list_mozillians_in_location', name='list_region_city'),
url(r'^country/(?P<country>[A-Za-z0-9 \.]+)/region/(?P<region>.+)/$',
Expand Down
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 2cedf98

Please sign in to comment.