Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def migrate_data(apps, schema_editor):
Tracker = apps.get_model('campaign', 'Tracker')
Syncer = apps.get_model('campaign', 'Syncer')
Key = apps.get_model('attribute', 'Key')
for k in Key.objects.all():
c = k.parent_campaign
if c.campaign_type == 'Panel':
new_camp = Syncer.objects.get(cid=c.cid)
new_camp = Tracker.objects.get(cid=c.cid)
logger.debug('processing key %s for %s -> %s', k, c, new_camp)
k.parent_campaign_new = new_camp # Key.parent_campaign_new is GenericForeignKey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.