Caching and refactors
This commit is contained in:
parent
67b06d7856
commit
8f1c8d6c96
33 changed files with 485 additions and 381 deletions
12
judge/jinja2/comment.py
Normal file
12
judge/jinja2/comment.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
from . import registry
|
||||
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
from judge.models.comment import get_visible_comment_count
|
||||
from judge.caching import cache_wrapper
|
||||
|
||||
|
||||
@registry.function
|
||||
def comment_count(obj):
|
||||
content_type = ContentType.objects.get_for_model(obj)
|
||||
return get_visible_comment_count(content_type, obj.pk)
|
Loading…
Add table
Add a link
Reference in a new issue