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

Commit

Permalink
data migration to merge city and country into location. #79
Browse files Browse the repository at this point in the history
  • Loading branch information
thraxil committed Feb 27, 2016
1 parent 05e2797 commit cfcb631
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spokehub/profile/migrations/0004_auto_20160227_1312.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations


def merge_to_location(apps, schema_editor):
User = apps.get_model("auth", "User")
for u in User.objects.all():
u.profile.location = "%s, %s" % (u.profile.city, u.profile.country)
u.profile.save()


class Migration(migrations.Migration):

dependencies = [
('profile', '0003_profile_location'),
]

operations = [
migrations.RunPython(merge_to_location),
]

0 comments on commit cfcb631

Please sign in to comment.