Skip to content

Instantly share code, notes, and snippets.

@robcmills
Created April 1, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robcmills/d18b5244731047ed5749 to your computer and use it in GitHub Desktop.
Save robcmills/d18b5244731047ed5749 to your computer and use it in GitHub Desktop.
Go Game Flavors Organizations Migration
from models.models import Flavor, Organization
organizations = Organization.objects(title__ne='Go Game USA')
flavor_ids = ['54e394b30df8257c2019fa19', '53ffbf1c129d7c22a3c98981', '54dd3fd80df8257c2019f9e9', '541fb9b7129d7c0a54f63c21', '549467030df8252dd18c64df']
flavors = Flavor.objects(id__in=flavor_ids)
for org in organizations:
for flavor in flavors:
flavor_copy = Flavor(**flavor._data)
flavor_copy.id = None
flavor_copy.organization = org
flavor_copy.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment