mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
Check that the user is a member of the parent club only at the creation of the membership
This commit is contained in:
parent
4997a37058
commit
9f258e39b6
@ -384,7 +384,8 @@ class Membership(models.Model):
|
||||
).exists():
|
||||
raise ValidationError(_('User is already a member of the club'))
|
||||
|
||||
if self.club.parent_club is not None:
|
||||
if self.club.parent_club is not None and not self.pk:
|
||||
# Check that the user is already a member of the parent club if the membership is created
|
||||
if not Membership.objects.filter(
|
||||
user=self.user,
|
||||
club=self.club.parent_club,
|
||||
|
Loading…
Reference in New Issue
Block a user