Skip to content
Snippets Groups Projects
Commit 568fd694 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'feature/keep-user-updated' into 'master'

Synchronise name and email to User object when saving a Person

See merge request AlekSIS/AlekSIS!151
parents 6ecd643a 5d94c5fe
No related branches found
No related tags found
1 merge request!151Synchronise name and email to User object when saving a Person
Pipeline #827 failed
......@@ -158,6 +158,16 @@ class Person(ExtensibleModel):
else:
return f"{self.first_name} {self.last_name}"
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
# Synchronise user fields to linked User object to keep it up to date
if self.user:
self.user.first_name = self.first_name
self.user.last_name = self.last_name
self.user.email = self.email
self.user.save()
def __str__(self) -> str:
return self.full_name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment