post_save.connect(record_comment_event, sender=Comment)\r
\r
\r
-def record_question_revision_event(instance, created, **kwargs):\r
- if created and instance.revision <> 1:\r
- activity = Activity(user=instance.author, active_at=instance.revised_at, content_object=instance, activity_type=TYPE_ACTIVITY_UPDATE_QUESTION)\r
+def record_revision_event(instance, created, **kwargs):\r
+ if created and instance.revision <> 1 and instance.node.node_type in ('question', 'answer',):\r
+ activity_type = instance.node == 'question' and TYPE_ACTIVITY_UPDATE_QUESTION or TYPE_ACTIVITY_UPDATE_ANSWER\r
+ activity = Activity(user=instance.author, active_at=instance.revised_at, content_object=instance, activity_type=activity_type)\r
activity.save()\r
\r
-post_save.connect(record_question_revision_event, sender=QuestionRevision)\r
-\r
-\r
-def record_answer_revision_event(instance, created, **kwargs):\r
- if created and instance.revision <> 1:\r
- activity = Activity(user=instance.author, active_at=instance.revised_at, content_object=instance, activity_type=TYPE_ACTIVITY_UPDATE_ANSWER)\r
- activity.save()\r
-\r
-post_save.connect(record_answer_revision_event, sender=AnswerRevision)\r
+post_save.connect(record_revision_event, sender=NodeRevision)\r
\r
\r
def record_award_event(instance, created, **kwargs):\r