From 932ea700f38924b4eb24cb51d1d13a041cd3a010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 19 Dec 2022 23:55:24 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20lep=C5=A1=C3=AD=20count=20ne=C5=BE=20try?= =?UTF-8?q?-catch=20p=C5=99i=20kontrole=20duplicitn=C3=AD=20p=C5=99ezd?= =?UTF-8?q?=C3=ADvky=20v=20p=C5=99ihl=C3=A1=C5=A1ce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- personalni/forms.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/personalni/forms.py b/personalni/forms.py index 2946745d..f9d90182 100644 --- a/personalni/forms.py +++ b/personalni/forms.py @@ -110,11 +110,8 @@ class PrihlaskaForm(PasswordResetForm): prezdivka_resitele = self.cleaned_data.get('prezdivka_resitele') if prezdivka_resitele == '': return prezdivka_resitele - try: - Resitel.objects.get(prezdivka_resitele=prezdivka_resitele) + if Resitel.objects.filter(prezdivka_resitele=prezdivka_resitele).count() > 0: raise forms.ValidationError('Přezdívka je již použita') - except ObjectDoesNotExist: - pass return prezdivka_resitele def clean_zasilat(self):