Skip to content

Commit

Permalink
'members' app receivers updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ellmetha committed Mar 7, 2015
1 parent 52c5f00 commit 5b06bb7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion machina/apps/forum_member/receivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import unicode_literals

# Third party imports
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import F
from django.db.models.signals import pre_save
from django.dispatch import receiver
Expand All @@ -25,7 +26,10 @@ def update_member_profile(sender, instance, **kwargs):
increase_posts_count = False

if instance.pk:
old_instance = instance.__class__._default_manager.get(pk=instance.pk)
try:
old_instance = instance.__class__._default_manager.get(pk=instance.pk)
except ObjectDoesNotExist: # pragma: no cover
return # this should never happen (except with django loaddata command)
if old_instance.approved is False and instance.approved is True:
increase_posts_count = True
elif instance.approved:
Expand Down

0 comments on commit 5b06bb7

Please sign in to comment.