Last active
December 25, 2015 12:49
-
-
Save nikolaygit/6979190 to your computer and use it in GitHub Desktop.
Add previous next pagination. 1) requirements.txt
2) settings.py
3) template.html
4) style.css
5) pagination-previous-next.html Uses Django Endless Pagination: http://django-endless-pagination.readthedocs.org/en/latest/index.html#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load endless %} | |
{% get_pages %} | |
<div class="pagination-previous-next"> | |
<span class="pagination-previous-next__previous">{{ pages.previous }}</span> | |
<span class="pagination-previous-next__next">{{ pages.next }}</span> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
django-endless-pagination==2.0 | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSTALLED_APPS = ( | |
# ... | |
'endless_pagination', | |
# ... | |
) | |
ENDLESS_PAGINATION_PER_PAGE = 7 | |
ENDLESS_PAGINATION_PREVIOUS_LABEL = '<b>〈</b> Zurück' | |
ENDLESS_PAGINATION_NEXT_LABEL = 'Weiter <b>〉</b>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.pagination-previous-next { | |
clear: both; | |
text-align: center; | |
} | |
.pagination-previous-next__previous { | |
padding-right: 20px; | |
} | |
.endless_page_link { | |
font-size: 24px; | |
color: $green; | |
} | |
.endless_page_link:hover { | |
text-decoration: none; | |
color: $green; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load endless %} | |
{% lazy_paginate object_list %} | |
{% for object in object_list %} | |
... | |
{% endfor %} | |
{% include 'pagination-previous-next.html' %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment