mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
refactor: Traduction en anglais des modules "GestionInscription" et
"GestionLogin"
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import logging
|
||||
from django.db.models import Q
|
||||
from GestionInscriptions.models import FicheInscription, Profil, Eleve
|
||||
from Subscriptions.models import RegistrationForm, Profile, Student
|
||||
|
||||
logger = logging.getLogger('N3wtSchool')
|
||||
|
||||
@ -43,12 +43,12 @@ def getProfile(objectList, valueToCheck):
|
||||
return result
|
||||
|
||||
def getEleveByCodeFI(_codeFI):
|
||||
eleve = None
|
||||
ficheInscriptions_List=getAllObjects(FicheInscription)
|
||||
for fi in ficheInscriptions_List:
|
||||
if fi.codeLienInscription == _codeFI:
|
||||
eleve = fi.eleve
|
||||
return eleve
|
||||
student = None
|
||||
ficheInscriptions_List=getAllObjects(RegistrationForm)
|
||||
for rf in ficheInscriptions_List:
|
||||
if rf.codeLienInscription == _codeFI:
|
||||
student = rf.student
|
||||
return student
|
||||
|
||||
def getLastId(_object):
|
||||
result = 1
|
||||
@ -61,7 +61,7 @@ def getLastId(_object):
|
||||
def searchObjects(_objectName, _searchTerm=None, _excludeStates=None):
|
||||
"""
|
||||
Recherche générique sur les objets avec possibilité d'exclure certains états
|
||||
_objectName: Classe du modèle
|
||||
_objectName: SchoolClass du modèle
|
||||
_searchTerm: Terme de recherche
|
||||
_excludeStates: Liste d'état à exclure de la recherche (optionnel)
|
||||
"""
|
||||
@ -70,18 +70,18 @@ def searchObjects(_objectName, _searchTerm=None, _excludeStates=None):
|
||||
|
||||
# Si on a un état à exclure
|
||||
if _excludeStates is not None:
|
||||
query = query.exclude(etat__in=_excludeStates)
|
||||
query = query.exclude(status__in=_excludeStates)
|
||||
|
||||
# Si on a un terme de recherche
|
||||
if _searchTerm and _searchTerm.strip():
|
||||
terms = _searchTerm.lower().strip().split()
|
||||
for term in terms:
|
||||
query = query.filter(
|
||||
Q(eleve__nom__icontains=term) |
|
||||
Q(eleve__prenom__icontains=term)
|
||||
Q(student__last_name__icontains=term) |
|
||||
Q(student__first_name__icontains=term)
|
||||
)
|
||||
|
||||
return query.order_by('eleve__nom', 'eleve__prenom')
|
||||
return query.order_by('student__last_name', 'student__first_name')
|
||||
|
||||
except _objectName.DoesNotExist:
|
||||
logging.error(f"Aucun résultat n'a été trouvé - {_objectName.__name__} (recherche: {_searchTerm})")
|
||||
|
||||
Reference in New Issue
Block a user