Skip to content

Commit

Permalink
Merge pull request #285 from chrisv2/fix_signals_loaddata
Browse files Browse the repository at this point in the history
disable post_save handling on fixture load
  • Loading branch information
lampslave committed Feb 8, 2018
2 parents 76efecb + 6307755 commit 0bee6f4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pybb/signals.py
Expand Up @@ -14,6 +14,9 @@ def topic_saved(instance, **kwargs):
notify_forum_subscribers(instance)

def post_saved(instance, **kwargs):
# signal triggered by loaddata command, ignore
if kwargs.get('raw', False):
return

if getattr(instance, '_post_saved_done', False):
#Do not spam users when post is saved more than once in a same request.
Expand Down Expand Up @@ -48,6 +51,10 @@ def post_deleted(instance, **kwargs):


def user_saved(instance, created, **kwargs):
# signal triggered by loaddata command, ignore
if kwargs.get('raw', False):
return

if not created:
return

Expand Down

0 comments on commit 0bee6f4

Please sign in to comment.