fix typo
This commit is contained in:
parent
6e72c08ef4
commit
a447cdfcf1
5 changed files with 9 additions and 19 deletions
|
@ -40,7 +40,6 @@ class BookMark(models.Model):
|
|||
except ObjectDoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("bookmark")
|
||||
verbose_name_plural = _("bookmarks")
|
||||
|
|
|
@ -65,16 +65,13 @@ def undobookmark_page(request):
|
|||
|
||||
|
||||
class BookMarkDetailView(TemplateResponseMixin, SingleObjectMixin, View):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(BookMarkDetailView, self).get_context_data(**kwargs)
|
||||
queryset = BookMark.objects.filter(page=self.get_comment_page())
|
||||
if queryset.exists() == False:
|
||||
bookmark = BookMark(page=self.get_comment_page(),)
|
||||
bookmark.save()
|
||||
context["bookmark"] = queryset.first()
|
||||
queryset = BookMark.objects.get_or_create(page=self.get_comment_page())
|
||||
context["bookmark"] = queryset[0]
|
||||
return context
|
||||
|
||||
|
||||
class BookMarkListView(ListView):
|
||||
def add_bookmark_context_data(self, context, obj_list="object_list"):
|
||||
for item in context[obj_list]:
|
||||
|
|
|
@ -101,11 +101,8 @@ class PageVoteDetailView(TemplateResponseMixin, SingleObjectMixin, View):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(PageVoteDetailView, self).get_context_data(**kwargs)
|
||||
queryset = PageVote.objects.filter(page=self.get_comment_page())
|
||||
if queryset.exists() == False:
|
||||
pagevote = PageVote(page=self.get_comment_page(), score=0)
|
||||
pagevote.save()
|
||||
context["pagevote"] = queryset.first()
|
||||
queryset = PageVote.objects.get_or_create(page=self.get_comment_page())
|
||||
context["pagevote"] = queryset[0]
|
||||
return context
|
||||
|
||||
|
||||
|
|
|
@ -365,10 +365,7 @@ class UserBookMarkPage(UserPage):
|
|||
context["postlist"] = pagelist
|
||||
context["problemlist"] = problemlist
|
||||
context["contestlist"] = contestlist
|
||||
|
||||
context["haspost"] = pagelist.exists()
|
||||
context["hasproblem"] = problemlist.exists()
|
||||
context["hascontest"] = contestlist.exists()
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue