Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
2 changed files with 20 additions and 1 deletions
Showing only changes of commit 320a0f110f - Show all commits

View File

@ -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

View File

@ -1,7 +1,7 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-
SCOVERSION = "9.6.35"
SCOVERSION = "9.6.36"
SCONAME = "ScoDoc"