Commit 766b1846 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

Merge branch 'master' of

parents 8d50825c 731fe28b
Pipeline #6789 passed with stage
in 27 seconds
......@@ -79,12 +79,16 @@ class Member(Model):
unique_together = ['user', 'project']
def __str__(self):
if is None:
return ""
def save(self, *args, **kwargs):
# cannot be duplicated Members
if not and Member.objects.filter(project=self.project, user=self.user).exists():
# override existing member
existing = Member.objects.get(project=self.project, user=self.user)
super(Member, self).save(*args, **kwargs)
......@@ -109,4 +113,5 @@ def set_captain_as_member(instance, created, **kwargs):
# add captain as an admin member, if they've not already been added
if created and instance.captain is not None and\
not instance.members.filter(user=instance.captain).exists():
Member.objects.create(user=instance.captain, project=instance, is_admin=True,
captain = Member(user=instance.captain, project=instance, is_admin=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment