From 0bb09118302df6f3cf32344b554854e8f601e158 Mon Sep 17 00:00:00 2001 From: Jonas Havelka Date: Sun, 5 Sep 2021 22:10:12 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20Duplik=C3=A1tn=C3=AD=20e-mail=20v=20editu?= =?UTF-8?q?=20(nebrat=20sebe)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seminar/forms.py | 2 +- seminar/views/views_all.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/seminar/forms.py b/seminar/forms.py index d5211bc9..1a83cb82 100644 --- a/seminar/forms.py +++ b/seminar/forms.py @@ -199,7 +199,7 @@ class ProfileEditForm(forms.Form): err_logger = logging.getLogger('seminar.prihlaska.problem') email = self.cleaned_data.get('email') try: - Osoba.objects.get(email=email) + Osoba.objects.exclude(user__username=self.username).get(email=email) msg = "Email {} exists (in edit)".format(email) err_logger.info(msg) raise forms.ValidationError('Email je již použit') diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 822a941d..f1085b60 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -1162,6 +1162,7 @@ def resitelEditView(request): form = PoMaturiteProfileEditForm(POST) else: form = ProfileEditForm(POST) + form.username = user_edit.username if form.is_valid(): ## Změny v osobě fcd = form.cleaned_data