From 933e7a7227802f0aee60a0295c08077467ee4250 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 5 Nov 2013 13:12:07 +0100 Subject: [PATCH 1/1] fix in key generation --- wtem/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.20.1