- def mark_deleted(self, user):
- if super(Comment, self).mark_deleted(user):
- self._update_post_comment_count(-1)
-
- def unmark_deleted(self):
- if super(Comment, self).unmark_deleted():
- self._update_post_comment_count(1)
-
- def is_reply_to(self, user):
- inreply = re.search('@\w+', self.comment)
- if inreply is not None:
- return user.username.startswith(inreply.group(0))
-
- return False
-
- def __unicode__(self):
- return self.comment
-
-
-class LikedComment(models.Model):
- comment = models.ForeignKey(Comment)
- user = models.ForeignKey(User)
- added_at = models.DateTimeField(default=datetime.datetime.now)
- canceled = models.BooleanField(default=False)
-
- active = ActiveObjectManager()