Change comment style (#70)
This commit is contained in:
parent
d80ec962a5
commit
1056a470b0
19 changed files with 680 additions and 306 deletions
|
@ -56,6 +56,7 @@ class Comment(MPTTModel):
|
|||
related_name="replies",
|
||||
on_delete=CASCADE,
|
||||
)
|
||||
|
||||
versions = VersionRelation()
|
||||
|
||||
class Meta:
|
||||
|
@ -111,6 +112,15 @@ class Comment(MPTTModel):
|
|||
if len(output) >= n:
|
||||
return output
|
||||
return output
|
||||
|
||||
@cached_property
|
||||
def get_replies(self):
|
||||
query = Comment.filter(parent=self)
|
||||
return len(query)
|
||||
|
||||
@cached_property
|
||||
def get_revisions(self):
|
||||
return self.versions.count()
|
||||
|
||||
@cached_property
|
||||
def page_title(self):
|
||||
|
@ -141,7 +151,7 @@ class Comment(MPTTModel):
|
|||
)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return "%s#comment-%d" % (self.link, self.id)
|
||||
return "%s?comment-id=%d#comment-%d" % (self.link, self.id, self.id)
|
||||
|
||||
|
||||
class CommentVote(models.Model):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue