add management command
parent
a8ab510c61
commit
ab0c8814b4
|
@ -0,0 +1,14 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
from regluit.core.models import Campaign
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = "set campaign edition for every campaign"
|
||||
|
||||
def handle(self, **options):
|
||||
fixed = 0
|
||||
for campaign in Campaign.objects.all():
|
||||
if not campaign.edition:
|
||||
campaign.edition = campaign.work.editions.all()[0]
|
||||
campaign.save()
|
||||
fixed +=1
|
||||
print "{} campaign editions set".format(fixed)
|
Loading…
Reference in New Issue