1 # -*- coding: utf-8 -*-
2 from django.core.management.base import BaseCommand
4 from wtem.models import Submission, Confirmation
7 class Command(BaseCommand):
9 def handle(self, **options):
13 for confirmation in Confirmation.objects.all():
14 if not Submission.objects.filter(email=confirmation.email).exists():
16 for attr in ['first_name', 'last_name', 'email', 'contact']:
17 args[attr] = getattr(confirmation, attr)
18 Submission.create(**args)
21 self.stdout.write('skipping ' + confirmation.email + ': already exists.')
24 self.stdout.write('New: ' + str(new) + ', skipped: ' + str(skipped))