-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Merlin Buczek
committed
Jun 2, 2019
1 parent
3514c2e
commit 70bf6ea
Showing
9 changed files
with
134 additions
and
14 deletions.
There are no files selected for viewing
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django import template | ||
|
||
|
||
register = template.Library() | ||
|
||
|
||
@register.simple_tag | ||
def url_replace(request, field, value): | ||
dict_ = request.GET.copy() | ||
dict_[field] = value | ||
return dict_.urlencode() |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{% load url_tags %} | ||
|
||
{% firstof items.number '1' as current %} | ||
|
||
<nav class="pagination is-centered" role="navigation" aria-label="pagination"> | ||
<a class="pagination-previous"><i class="fas fa-chevron-left"></i></a> | ||
<ul class="pagination-list"> | ||
{% if current|add:0 >= 3 %} | ||
<li> | ||
<a class="pagination-link" href="?{% url_replace request 'page' 1 %}">1</a> | ||
</li> | ||
{% if current|add:0 >= 4 %} | ||
<li> | ||
<span class="pagination-ellipsis">…</span> | ||
</li> | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% if current|add:0 >= 2 %} | ||
<li> | ||
<a class="pagination-link" href="?{% url_replace request 'page' current|add:'-1' %}">{{ current|add:'-1' }}</a> | ||
</li> | ||
{% endif %} | ||
|
||
<li> | ||
<a class="pagination-link is-current" aria-current="page">{{ current }}</a> | ||
</li> | ||
|
||
{% if current|add:0 <= paginator.num_pages|add:'-1' %} | ||
<li> | ||
<a class="pagination-link" href="?{% url_replace request 'page' current|add:'1' %}">{{ current|add:'1' }}</a> | ||
</li> | ||
{% endif %} | ||
|
||
{% if current|add:2 <= paginator.num_pages %} | ||
{% if current|add:3 <= paginator.num_pages %} | ||
<li> | ||
<span class="pagination-ellipsis">…</span> | ||
</li> | ||
{% endif %} | ||
<li> | ||
<a class="pagination-link" href="?{% url_replace request 'page' paginator.num_pages %}">{{ paginator.num_pages }}</a> | ||
</li> | ||
{% endif %} | ||
</ul> | ||
<a class="pagination-next"><i class="fas fa-chevron-right"></i></a> | ||
</nav> | ||
|
||
<!-- <nav class="pagination is-centered" role="navigation" aria-label="pagination"> | ||
<a class="pagination-previous">Previous</a> | ||
<a class="pagination-next">Next page</a> | ||
<ul class="pagination-list"> | ||
<li><a class="pagination-link" aria-label="Goto page 1">1</a></li> | ||
<li><span class="pagination-ellipsis">…</span></li> | ||
<li><a class="pagination-link" aria-label="Goto page 45">45</a></li> | ||
<li><a class="pagination-link is-current" aria-label="Page 46" aria-current="page">46</a></li> | ||
<li><a class="pagination-link" aria-label="Goto page 47">47</a></li> | ||
<li><span class="pagination-ellipsis">…</span></li> | ||
<li><a class="pagination-link" aria-label="Goto page 86">86</a></li> | ||
</ul> | ||
</nav> --> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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