* adds button and functionality for leaving a team
   * if the admin leaves the team, another user will be chosen as new admin automatically
* improves Team (django) admin backend
   * better control over user adding-removing
   * only added team members are selectable as admin
This commit is contained in:
2022-04-13 15:52:41 +02:00
parent bf1c0e2078
commit 87fae51144
8 changed files with 105 additions and 42 deletions

View File

@@ -93,3 +93,17 @@ class Team(UuidModel):
"""
mailer = Mailer()
mailer.send_mail_shared_data_deleted_team(obj_identifier, obj_title, self)
def remove_user(self, user):
""" Removes a user from the team
Args:
user (User): The user to be removed
Returns:
"""
self.users.remove(user)
if self.admin == user:
self.admin = self.users.first()
self.save()