From 98ac3f63bf274b9ff65d0aef1b294d446cb40b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 19 Dec 2022 23:52:11 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20kontrola=20duplicitn=C3=AD=20p=C5=99ezd?= =?UTF-8?q?=C3=ADvky=20p=C5=99i=20editaci=20osobn=C3=ADch=20=C3=BAdaj?= =?UTF-8?q?=C5=AF?= 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 5f0d27f6..2946745d 100644 --- a/personalni/forms.py +++ b/personalni/forms.py @@ -208,11 +208,8 @@ class ProfileEditForm(forms.Form): 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).exclude(osoba__user__username=self.username).count() > 0: raise forms.ValidationError('Přezdívka je již použita') - except ObjectDoesNotExist: - pass return prezdivka_resitele def clean_email(self):