mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 05:02:23 +00:00
Search juries by "{first_name} {last_name}"
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
acf906b284
commit
43af14ad77
@ -13,6 +13,8 @@ from django import forms
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import FileExtensionValidator
|
from django.core.validators import FileExtensionValidator
|
||||||
|
from django.db.models import CharField, Value
|
||||||
|
from django.db.models.functions import Concat
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from pypdf import PdfReader
|
from pypdf import PdfReader
|
||||||
|
|
||||||
@ -301,10 +303,10 @@ class UploadNotesForm(forms.Form):
|
|||||||
_("The following note is higher of the maximum expected value:")
|
_("The following note is higher of the maximum expected value:")
|
||||||
+ str(n) + " > " + str(max_n))
|
+ str(n) + " > " + str(max_n))
|
||||||
|
|
||||||
first_name, last_name = tuple(name.replace('’', '\'').split(' ', 1))
|
# Search by "{first_name} {last_name}"
|
||||||
|
jury = User.objects.annotate(full_name=Concat('first_name', Value(' '), 'last_name',
|
||||||
jury = User.objects.filter(first_name=first_name, last_name=last_name,
|
output_field=CharField())) \
|
||||||
registration__volunteerregistration__isnull=False)
|
.filter(full_name=name.replace('’', '\''), registration__volunteerregistration__isnull=False)
|
||||||
if jury.count() != 1:
|
if jury.count() != 1:
|
||||||
self.add_error('file', _("The following user was not found:") + " " + name)
|
self.add_error('file', _("The following user was not found:") + " " + name)
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user