X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/e0ca24b203011b28d4fe07fb3c1c76f00fdea959..7ccedc9d976cd5b312760bed776ff096bb9463d5:/wtem/models.py?ds=inline diff --git a/wtem/models.py b/wtem/models.py index b6858cc..4a42c30 100644 --- a/wtem/models.py +++ b/wtem/models.py @@ -22,28 +22,17 @@ class Submission(models.Model): return key @classmethod - def create(cls, first_name, last_name, email, contact = None, key = None): - submissions = [] - - if contact: - students = contact['students'] - else: - students = [dict(first_name = first_name, last_name = last_name, email = email)] - - if key is None: - key = Submission.generate_key() - - for student in students: - submission = cls( - contact = contact, - key = key, - first_name = student['first_name'], - last_name = student['last_name'], - email = student['email'] - ) - submission.save() - submissions.append(submission) - return submissions + def create(cls, first_name, last_name, email, key = None, contact = None): + submission = cls( + contact = contact, + key = key if key else Submission.generate_key(), + first_name = first_name, + last_name = last_name, + email = email + ) + + submission.save() + return submission class Attachment(models.Model):