mirror of https://gitlab.crans.org/bde/nk20
Before checking membership roles, we wait before the creation of the membership
This commit is contained in:
parent
76a6260b18
commit
12ebf9d12a
|
@ -302,12 +302,13 @@ class Membership(models.Model):
|
||||||
if not Membership.objects.filter(user=self.user, club=self.club.parent_club).exists():
|
if not Membership.objects.filter(user=self.user, club=self.club.parent_club).exists():
|
||||||
raise ValidationError(_('User is not a member of the parent club') + ' ' + self.club.parent_club.name)
|
raise ValidationError(_('User is not a member of the parent club') + ' ' + self.club.parent_club.name)
|
||||||
|
|
||||||
for role in self.roles.all():
|
if self.pk:
|
||||||
club = role.for_club
|
for role in self.roles.all():
|
||||||
if club is not None:
|
club = role.for_club
|
||||||
if club.pk != self.club_id:
|
if club is not None:
|
||||||
raise ValidationError(_('The role {role} does not apply to the club {club}.')
|
if club.pk != self.club_id:
|
||||||
.format(role=role.name, club=club.name))
|
raise ValidationError(_('The role {role} does not apply to the club {club}.')
|
||||||
|
.format(role=role.name, club=club.name))
|
||||||
|
|
||||||
created = not self.pk
|
created = not self.pk
|
||||||
if created:
|
if created:
|
||||||
|
|
Loading…
Reference in New Issue