diff options
Diffstat (limited to 'app/lib')
-rw-r--r-- | app/lib/django_comments/abstracts.py | 2 | ||||
-rw-r--r-- | app/lib/django_comments/models.py | 2 | ||||
-rw-r--r-- | app/lib/pagination/templates/pagination/pagination.html | 2 | ||||
-rw-r--r-- | app/lib/pagination/templatetags/pagination_tags.py | 6 |
4 files changed, 6 insertions, 6 deletions
diff --git a/app/lib/django_comments/abstracts.py b/app/lib/django_comments/abstracts.py index 4fbb94a..f4ff362 100644 --- a/app/lib/django_comments/abstracts.py +++ b/app/lib/django_comments/abstracts.py @@ -6,7 +6,7 @@ from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from django.db import models from django.utils import timezone -from django.utils.encoding import python_2_unicode_compatible +from six import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ try: from django.urls import reverse diff --git a/app/lib/django_comments/models.py b/app/lib/django_comments/models.py index ebf1bc5..204cf2e 100644 --- a/app/lib/django_comments/models.py +++ b/app/lib/django_comments/models.py @@ -1,7 +1,7 @@ +from six import python_2_unicode_compatible from django.conf import settings from django.db import models from django.utils import timezone -from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from .abstracts import ( diff --git a/app/lib/pagination/templates/pagination/pagination.html b/app/lib/pagination/templates/pagination/pagination.html index e2f8e42..0a7f9a4 100644 --- a/app/lib/pagination/templates/pagination/pagination.html +++ b/app/lib/pagination/templates/pagination/pagination.html @@ -1,6 +1,6 @@ {% load pagination_tags %}{% if is_paginated %} <ul class="pages">{% if page_obj.has_previous %} - <li><a href="{% page_path prev_page %}" class="prev"> Newer</a></li>{% endif %}{% for page in pages %}{% if page %}{% if page == page_obj.number %} + <li><a href="{% if prev_page == 1%}/{{request.base_path}}/{%else%}{% page_path prev_page %}{%endif%}" class="prev"> Newer</a></li>{% endif %}{% for page in pages %}{% if page %}{% if page == page_obj.number %} <li class="current page">{{ page }}</li>{% else %} <li><a href="{% if page == 1%}/{{request.base_path}}/{%else%}{% page_path page %}{%endif%}" class="page">{{ page }}</a></li>{% endif %}{% else %} <li>...</li>{% endif %}{% endfor %}{% if page_obj.has_next %} diff --git a/app/lib/pagination/templatetags/pagination_tags.py b/app/lib/pagination/templatetags/pagination_tags.py index 75c23f6..0356f1f 100644 --- a/app/lib/pagination/templatetags/pagination_tags.py +++ b/app/lib/pagination/templatetags/pagination_tags.py @@ -5,7 +5,7 @@ except NameError: import re from django import template from django.db.models.query import QuerySet -from django.core.paginator import Paginator, QuerySetPaginator, InvalidPage +from django.core.paginator import Paginator, InvalidPage register = template.Library() @@ -21,7 +21,7 @@ def page_path(parser, token): raise template.TemplateSyntaxError( 'page_path requires a page template var' ) - + return PagePathNode(bits[1]) class PagePathNode(template.Node): @@ -99,7 +99,7 @@ class AutoPaginateNode(template.Node): value = self.queryset_var.resolve(context) if issubclass(value.__class__, QuerySet): model = value.model - paginator_class = QuerySetPaginator + paginator_class = Paginator else: value = list(value) try: |