Commit efd4b48a authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg

Update is_staff when changing committee memberships

parent d011b43a
......@@ -236,6 +236,10 @@ class CommitteeMembership(models.Model, metaclass=ModelTranslateMeta):
self._was_chair = self.chair
super().save(*args, **kwargs)
self.member.user.is_staff = self.member.membership_set.exclude(
until__lt=timezone.now().date()).count() >= 1
self.member.user.save()
def delete(self, *args, **kwargs):
"""Deactivates active memberships, deletes inactive ones"""
if self.is_active:
......
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