From: Aleksander Ɓukasz Date: Tue, 5 Nov 2013 12:12:07 +0000 (+0100) Subject: fix in key generation X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/933e7a7227802f0aee60a0295c08077467ee4250 fix in key generation --- diff --git a/wtem/models.py b/wtem/models.py index 5cb7096..30539b2 100644 --- a/wtem/models.py +++ b/wtem/models.py @@ -19,7 +19,7 @@ class Submission(models.Model): @classmethod def generate_key(cls): key = '' - while not key and key in [record['key'] for record in cls.objects.values('key')]: + while not key or key in [record['key'] for record in cls.objects.values('key')]: key = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for i in range(30)) return key