Renforce les vérifications clonage étudiant dans autre dept
This commit is contained in:
parent
77993ec9e7
commit
320a0f110f
@ -96,6 +96,25 @@ class Identite(db.Model):
|
||||
raise ScoValueError(
|
||||
"clonage étudiant: le département destination est identique à celui de départ"
|
||||
)
|
||||
# Vérifie les contraintes d'unicité
|
||||
# ("dept_id", "code_nip") et ("dept_id", "code_ine")
|
||||
if (
|
||||
self.code_nip is not None
|
||||
and Identite.query.filter_by(
|
||||
dept_id=new_dept_id, code_nip=self.code_nip
|
||||
).count()
|
||||
> 0
|
||||
) or (
|
||||
self.code_ine is not None
|
||||
and Identite.query.filter_by(
|
||||
dept_id=new_dept_id, code_ine=self.code_ine
|
||||
).count()
|
||||
> 0
|
||||
):
|
||||
raise ScoValueError(
|
||||
"""clonage étudiant: un étudiant de même code existe déjà
|
||||
dans le département destination"""
|
||||
)
|
||||
d = dict(self.__dict__)
|
||||
d.pop("id", None) # get rid of id
|
||||
d.pop("_sa_instance_state", None) # get rid of SQLAlchemy special attr
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.35"
|
||||
SCOVERSION = "9.6.36"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user