mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Save contact_email only if it is different
This commit is contained in:
parent
fe98376efb
commit
5704633d14
1 changed files with 6 additions and 0 deletions
|
@ -60,6 +60,12 @@ class Student(db.Model):
|
||||||
|
|
||||||
part_students = db.relationship("PartStudent", back_populates="student", lazy=True)
|
part_students = db.relationship("PartStudent", back_populates="student", lazy=True)
|
||||||
|
|
||||||
|
def __init__(self, uni_email, contact_email=None, **kwargs):
|
||||||
|
if contact_email is not None and uni_email.strip() == contact_email.strip():
|
||||||
|
contact_email = None
|
||||||
|
|
||||||
|
super().__init__(uni_email=uni_email, contact_email=contact_email, **kwargs)
|
||||||
|
|
||||||
def str(self):
|
def str(self):
|
||||||
return f"{self.first_name} {self.last_name}"
|
return f"{self.first_name} {self.last_name}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue