class Meta:\r
app_label = 'forum'\r
\r
-class Activity(MetaContent):\r
+class Activity(GenericContent):\r
"""\r
We keep some history data for user activities\r
"""\r
activity_record.send(sender=self.activity_type, instance=self)\r
\r
@property\r
- def question(self):\r
- if self.activity_type == const.TYPE_ACTIVITY_ASK_QUESTION:\r
- return self.content_object\r
- elif self.activity_type in (const.TYPE_ACTIVITY_ANSWER,\r
+ def node(self):\r
+ if self.activity_type in (const.TYPE_ACTIVITY_ANSWER, const.TYPE_ACTIVITY_ASK_QUESTION,\r
const.TYPE_ACTIVITY_MARK_ANSWER, const.TYPE_ACTIVITY_UPDATE_QUESTION):\r
- return self.content_object.question\r
- elif self.activity_type == const.TYPE_ACTIVITY_COMMENT_QUESTION:\r
- return self.content_object.content_object\r
- elif self.activity_type == const.TYPE_ACTIVITY_COMMENT_ANSWER:\r
- return self.content_object.content_object.question\r
- elif self.activity_type == const.TYPE_ACTIVITY_UPDATE_ANSWER:\r
- return self.content_object.content_object.answer.question\r
- else:\r
- raise NotImplementedError()\r
+ return self.content_object\r
+\r
+ if self.activity_type in (const.TYPE_ACTIVITY_COMMENT_QUESTION,\r
+ const.TYPE_ACTIVITY_COMMENT_ANSWER, const.TYPE_ACTIVITY_UPDATE_ANSWER):\r
+ return self.content_object.node.leaf\r
+ \r
+ raise NotImplementedError()\r
\r
@property\r
def type_as_string(self):\r
elif self.activity_type == const.TYPE_ACTIVITY_MARK_ANSWER:\r
return _("marked an answer")\r
elif self.activity_type == const.TYPE_ACTIVITY_UPDATE_QUESTION:\r
- return _("edited")\r
+ return _("edited a question")\r
elif self.activity_type == const.TYPE_ACTIVITY_COMMENT_QUESTION:\r
- return _("commented")\r
+ return _("commented a question")\r
elif self.activity_type == const.TYPE_ACTIVITY_COMMENT_ANSWER:\r
return _("commented an answer")\r
elif self.activity_type == const.TYPE_ACTIVITY_UPDATE_ANSWER:\r
return _("edited an answer")\r
+ elif self.activity_type == const.TYPE_ACTIVITY_PRIZE:\r
+ return _("received badge")\r
else:\r
raise NotImplementedError()\r
\r