Comment page speed

This commit is contained in:
cuom1999 2023-09-28 18:23:39 -05:00
parent cbcbbc5277
commit 0e1a3992eb
4 changed files with 12 additions and 21 deletions

View file

@ -15,12 +15,11 @@ from django.http import (
HttpResponseBadRequest,
HttpResponseForbidden,
)
from django.shortcuts import get_object_or_404
from django.shortcuts import get_object_or_404, render
from django.utils.translation import gettext as _
from django.views.decorators.http import require_POST
from django.views.generic import DetailView, UpdateView
from django.urls import reverse_lazy
from django.template import loader
from reversion import revisions
from reversion.models import Version
@ -42,11 +41,6 @@ __all__ = [
@login_required
# def get_more_reply(request, id):
# queryset = Comment.get_pk(id)
def vote_comment(request, delta):
if abs(delta) != 1:
return HttpResponseBadRequest(
@ -164,10 +158,11 @@ def get_comments(request, limit=10):
new_offset = offset + min(len(queryset), limit)
comment_html = loader.render_to_string(
return render(
request,
"comments/content-list.html",
{
"request": request,
"profile": profile,
"comment_root_id": comment_root_id,
"comment_list": queryset,
"vote_hide_threshold": settings.DMOJ_COMMENT_VOTE_HIDE_THRESHOLD,
@ -181,8 +176,6 @@ def get_comments(request, limit=10):
},
)
return HttpResponse(comment_html)
def get_show_more(request):
return get_comments(request)