summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/models.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 7e0fbb2..152289f 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1026,7 +1026,10 @@ class Profile(models.Model):
self.user.groups.remove(group)
def save(self, *args, **kwargs):
- self._toggle_moderator_group(group_name=MOD_GROUP_NAME)
+ if self.pk is not None:
+ old_profile = Profile.objects.get(pk=self.pk)
+ if old_profile.is_moderator != self.is_moderator:
+ self._toggle_moderator_group(group_name=MOD_GROUP_NAME)
super(Profile, self).save(*args, **kwargs)
def __str__(self):