Change comment style (#67)

This commit is contained in:
Dung T.Bui 2023-05-20 06:52:37 +07:00 committed by GitHub
parent 966e8c9db5
commit 411f3da45e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
784 changed files with 696 additions and 307 deletions

0
judge/models/__init__.py Normal file → Executable file
View file

0
judge/models/bookmark.py Normal file → Executable file
View file

0
judge/models/choices.py Normal file → Executable file
View file

12
judge/models/comment.py Normal file → Executable file
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):

0
judge/models/contest.py Normal file → Executable file
View file

0
judge/models/course.py Normal file → Executable file
View file

0
judge/models/interface.py Normal file → Executable file
View file

0
judge/models/message.py Normal file → Executable file
View file

0
judge/models/pagevote.py Normal file → Executable file
View file

0
judge/models/problem.py Normal file → Executable file
View file

0
judge/models/problem_data.py Normal file → Executable file
View file

0
judge/models/profile.py Normal file → Executable file
View file

0
judge/models/runtime.py Normal file → Executable file
View file

0
judge/models/submission.py Normal file → Executable file
View file

0
judge/models/ticket.py Normal file → Executable file
View file

0
judge/models/volunteer.py Normal file → Executable file
View file