Change comment style (#70)

This commit is contained in:
Dung T.Bui 2023-05-22 20:52:18 +07:00 committed by GitHub
parent d80ec962a5
commit 1056a470b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 680 additions and 306 deletions

View file

@ -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):