Generate submission from latest contact
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 12 Nov 2013 12:03:24 +0000 (13:03 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 15 Jan 2014 10:18:58 +0000 (11:18 +0100)
wtem/management/commands/wtem_generate_keys.py

index 0fc537b..8a14ff9 100644 (file)
@@ -10,7 +10,7 @@ class Command(BaseCommand):
         new = 0
         skipped = 0
 
         new = 0
         skipped = 0
 
-        for wtem_contact in Contact.objects.filter(form_tag = 'wtem'):
+        for wtem_contact in Contact.objects.filter(form_tag = 'wtem').order_by('-created_at'):
             for student in wtem_contact.body['student']:
                 if not Submission.objects.filter(email = student['email']).exists():
                     args = dict()
             for student in wtem_contact.body['student']:
                 if not Submission.objects.filter(email = student['email']).exists():
                     args = dict()