def create_recipients_dict(usr_list):\r
return [(s['username'], s['email'], {'username': s['username']}) for s in usr_list]\r
\r
-def question_posted(sender, instance, **kwargs):\r
- question = instance.content_object\r
+def question_posted(instance, created, **kwargs):\r
+ if not created: return\r
+\r
+ question = instance\r
\r
subscribers = User.objects.values('email', 'username').filter(\r
Q(subscription_settings__enable_notifications=True, subscription_settings__new_question='i') |\r
for user in new_subscribers:\r
create_subscription_if_not_exists(question, user)\r
\r
-activity_record.connect(question_posted, sender=const.TYPE_ACTIVITY_ASK_QUESTION, weak=False)\r
+#post_save.connect(question_posted, sender=Question)\r
+\r
\r
+def answer_posted(instance, created, **kwargs):\r
+ if not created: return\r
\r
-def answer_posted(sender, instance, **kwargs):\r
- answer = instance.content_object\r
+ answer = instance\r
question = answer.question\r
\r
subscribers = question.subscribers.values('email', 'username').filter(\r
if answer.author.subscription_settings.questions_answered:\r
create_subscription_if_not_exists(question, answer.author)\r
\r
-activity_record.connect(answer_posted, sender=const.TYPE_ACTIVITY_ANSWER, weak=False)\r
+post_save.connect(answer_posted, sender=Answer)\r
\r
\r
def comment_posted(sender, instance, **kwargs):\r