old_contents: # -*- coding: utf-8 -*-
  from __future__ import unicode_literals
  
  from django.db import models, migrations
  from temba.campaigns.models import CampaignEvent, EventFire
  
  class Migration(migrations.Migration):
  
      def recalculate_event_fires(apps, schema_editor):
          for event in CampaignEvent.objects.filter(is_active=True).select_related('campaign').order_by('campaign__org'):
              print "%s: %s, %d%s" % (event.campaign.org.name, event.campaign.name, event.offset, event.unit)
              EventFire.update_eventfires_for_event(event)
  
      dependencies = [
          ('campaigns', '0005_auto_20150604_0723'),
      ]
  
      operations = [
          migrations.RunPython(
              recalculate_event_fires
          )
      ]
  
new_contents: # -*- coding: utf-8 -*-
  from __future__ import unicode_literals
  
  from django.db import models, migrations
  from temba.campaigns.models import CampaignEvent, EventFire
  
  class Migration(migrations.Migration):
  
      def recalculate_event_fires(apps, schema_editor):
          for event in CampaignEvent.objects.filter(is_active=True).select_related('campaign').order_by('campaign__org'):
              print "%s: %s, %d%s" % (unicode(event.campaign.org.name), unicode(event.campaign.name), event.offset, event.unit)
              EventFire.update_eventfires_for_event(event)
  
      dependencies = [
          ('campaigns', '0005_auto_20150604_0723'),
      ]
  
      operations = [
          migrations.RunPython(
              recalculate_event_fires
          )
      ]
  
subject: tweak debug