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:
|
except ObjectDoesNotExist:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("bookmark")
|
verbose_name = _("bookmark")
|
||||||
verbose_name_plural = _("bookmarks")
|
verbose_name_plural = _("bookmarks")
|
||||||
|
|
|
@ -65,16 +65,13 @@ def undobookmark_page(request):
|
||||||
|
|
||||||
|
|
||||||
class BookMarkDetailView(TemplateResponseMixin, SingleObjectMixin, View):
|
class BookMarkDetailView(TemplateResponseMixin, SingleObjectMixin, View):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(BookMarkDetailView, self).get_context_data(**kwargs)
|
context = super(BookMarkDetailView, self).get_context_data(**kwargs)
|
||||||
queryset = BookMark.objects.filter(page=self.get_comment_page())
|
queryset = BookMark.objects.get_or_create(page=self.get_comment_page())
|
||||||
if queryset.exists() == False:
|
context["bookmark"] = queryset[0]
|
||||||
bookmark = BookMark(page=self.get_comment_page(),)
|
|
||||||
bookmark.save()
|
|
||||||
context["bookmark"] = queryset.first()
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class BookMarkListView(ListView):
|
class BookMarkListView(ListView):
|
||||||
def add_bookmark_context_data(self, context, obj_list="object_list"):
|
def add_bookmark_context_data(self, context, obj_list="object_list"):
|
||||||
for item in context[obj_list]:
|
for item in context[obj_list]:
|
||||||
|
|
|
@ -101,11 +101,8 @@ class PageVoteDetailView(TemplateResponseMixin, SingleObjectMixin, View):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(PageVoteDetailView, self).get_context_data(**kwargs)
|
context = super(PageVoteDetailView, self).get_context_data(**kwargs)
|
||||||
queryset = PageVote.objects.filter(page=self.get_comment_page())
|
queryset = PageVote.objects.get_or_create(page=self.get_comment_page())
|
||||||
if queryset.exists() == False:
|
context["pagevote"] = queryset[0]
|
||||||
pagevote = PageVote(page=self.get_comment_page(), score=0)
|
|
||||||
pagevote.save()
|
|
||||||
context["pagevote"] = queryset.first()
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -366,9 +366,6 @@ class UserBookMarkPage(UserPage):
|
||||||
context["problemlist"] = problemlist
|
context["problemlist"] = problemlist
|
||||||
context["contestlist"] = contestlist
|
context["contestlist"] = contestlist
|
||||||
|
|
||||||
context["haspost"] = pagelist.exists()
|
|
||||||
context["hasproblem"] = problemlist.exists()
|
|
||||||
context["hascontest"] = contestlist.exists()
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block user_content %}
|
{% block user_content %}
|
||||||
{% if haspost %}
|
{% if postlist %}
|
||||||
<div class="bookmark-group">
|
<div class="bookmark-group">
|
||||||
<h3 class="unselectable toggle closed">
|
<h3 class="unselectable toggle closed">
|
||||||
<span class="fa fa-chevron-right fa-fw"></span>{{ _('Bookmarked Posts') }} ({{ postlist|length }})
|
<span class="fa fa-chevron-right fa-fw"></span>{{ _('Bookmarked Posts') }} ({{ postlist|length }})
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<i>{{ _('You have not yet bookmarked any post.') }}</i>
|
<i>{{ _('You have not yet bookmarked any post.') }}</i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<hr>
|
<hr>
|
||||||
{% if hasproblem %}
|
{% if problemlist %}
|
||||||
<div class="bookmark-group">
|
<div class="bookmark-group">
|
||||||
<h3 class="unselectable toggle closed">
|
<h3 class="unselectable toggle closed">
|
||||||
<span class="fa fa-chevron-right fa-fw"></span>{{ _('Bookmarked Problems') }} ({{ problemlist|length }})
|
<span class="fa fa-chevron-right fa-fw"></span>{{ _('Bookmarked Problems') }} ({{ problemlist|length }})
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
<i>{{ _('You have not yet bookmarked any problem.') }}</i>
|
<i>{{ _('You have not yet bookmarked any problem.') }}</i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<hr>
|
<hr>
|
||||||
{% if hascontest %}
|
{% if contestlist %}
|
||||||
<div class="bookmark-group">
|
<div class="bookmark-group">
|
||||||
<h3 class="unselectable toggle closed">
|
<h3 class="unselectable toggle closed">
|
||||||
<span class="fa fa-chevron-right fa-fw"></span>{{ _('Bookmarked Contests') }} ({{ contestlist|length }})
|
<span class="fa fa-chevron-right fa-fw"></span>{{ _('Bookmarked Contests') }} ({{ contestlist|length }})
|
||||||
|
|
Loading…
Reference in a new issue