1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-08-16 11:30:00 +02:00

Add autocomplete feature for jury form

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-03-23 23:04:22 +01:00
parent 40aa2e520f
commit 1dd9a5cf94
5 changed files with 107 additions and 37 deletions

View File

@@ -810,8 +810,9 @@ class PoolJuryView(VolunteerMixin, FormView, DetailView):
# The user already exists, so we don't recreate it
user.refresh_from_db()
reg = user.registration
if reg.participates:
form.add_error(None, _("This user already exists, but is a participant."))
if reg in self.object.juries.all():
messages.warning(self.request, _("The jury {name} is already in the pool!")
.format(name=f"{user.first_name} {user.last_name}"))
return self.form_invalid(form)
else:
# Save the user object first