5 class Meta(Node.Meta):
\r
6 ordering = ('-added_at',)
\r
9 def _update_parent_comment_count(self, diff):
\r
10 parent = self.parent
\r
11 parent.comment_count = parent.comment_count + diff
\r
20 return self.absolute_parent.headline
\r
23 def content_object(self):
\r
24 return self.parent.leaf
\r
26 def save(self, *args, **kwargs):
\r
27 super(Comment,self).save(*args, **kwargs)
\r
30 self._update_parent_comment_count(1)
\r
35 logging.debug('problem pinging google did you register you sitemap with google?')
\r
37 def mark_deleted(self, user):
\r
38 if super(Comment, self).mark_deleted(user):
\r
39 self._update_parent_comment_count(-1)
\r
41 def unmark_deleted(self):
\r
42 if super(Comment, self).unmark_deleted():
\r
43 self._update_parent_comment_count(1)
\r
45 def is_reply_to(self, user):
\r
46 inreply = re.search('@\w+', self.body)
\r
47 if inreply is not None:
\r
48 return user.username.startswith(inreply.group(0))
\r
52 def get_absolute_url(self):
\r
53 return self.absolute_parent.get_absolute_url() + "#%d" % self.id
\r
55 def __unicode__(self):
\r