def summary(self):\r
return strip_tags(self.html)[:300]\r
\r
- def update_last_activity(self, user):\r
+ @models.permalink\r
+ def get_revisions_url(self):\r
+ return ('revisions', (), {'id': self.id})\r
+\r
+ def update_last_activity(self, user, save=False):\r
self.last_activity_by = user\r
self.last_activity_at = datetime.datetime.now()\r
\r
if self.parent:\r
- self.parent.update_last_activity(user)\r
+ self.parent.update_last_activity(user, save=True)\r
+\r
+ if save:\r
+ self.save()\r
\r
def _create_revision(self, user, number, **kwargs):\r
revision = NodeRevision(author=user, revision=number, node=self, **kwargs)\r
revision.save()\r
return revision\r
\r
- def create_revision(self, user, action=None, **kwargs):\r
+ def create_revision(self, user, **kwargs):\r
number = self.revisions.aggregate(last=models.Max('revision'))['last'] + 1\r
revision = self._create_revision(user, number, **kwargs)\r
- self.activate_revision(user, revision, action)\r
+ self.activate_revision(user, revision)\r
return revision\r
\r
- def activate_revision(self, user, revision, action=None):\r
+ def activate_revision(self, user, revision):\r
self.title = revision.title\r
self.tagnames = revision.tagnames\r
self.body = revision.body\r
self.active_revision = revision\r
self.update_last_activity(user)\r
\r
- if action:\r
- self.last_edited = action\r
-\r
self.save()\r
\r
def get_tag_list_if_changed(self):\r
\r
@staticmethod\r
def isSpam(comment, data):\r
- api = Akismet()\r
+ #api = Akismet()\r
+\r
+ #if not api.key:\r
+ # return False\r
+ #else:\r
+ # if api.comment_check(comment, data):\r
+ # return True\r
+ # else:\r
+ # return False\r
+ # return data\r
+ return False\r
\r
- if not api.key:\r
- return False\r
- else:\r
- if api.comment_check(comment, data):\r
- return True\r
- else:\r
- return False\r
- return data\r
\r
class Meta:\r
app_label = 'forum'\r