Merge branch 'master' of https://github.com/LQDJudge/online-judge into pagevote

This commit is contained in:
Zhao-Linux 2022-11-18 02:17:56 +07:00
commit 8108967959
5 changed files with 35 additions and 13 deletions

View file

@ -109,12 +109,9 @@ class PageVoteDetailView(TemplateResponseMixin, SingleObjectMixin, View):
return context
class PageVoteListView(ListView):
pagevote_page = None
def get_context_data(self, **kwargs):
context = super(PageVoteListView, self).get_context_data(**kwargs)
for item in context["object_list"]:
class PageVoteListView:
def add_pagevote_context_data(self, context, obj_list="object_list"):
for item in context[obj_list]:
pagevote, _ = PageVote.objects.get_or_create(
page=self.get_comment_page(item)
)