fix pagination
This commit is contained in:
parent
fcfbc77143
commit
cedc3fec64
|
@ -47,7 +47,7 @@
|
||||||
<div class="small-4 small-offset-4 columns">
|
<div class="small-4 small-offset-4 columns">
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
{% if results.has_previous %}
|
{% if results.has_previous %}
|
||||||
<li><a href="?page={{ results.previous_page_number }}">«</a></li>
|
<li><a href="?q={{ query }}&page={{ results.previous_page_number }}">«</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="disabled"><span>«</span></li>
|
<li class="disabled"><span>«</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -55,11 +55,11 @@
|
||||||
{% if results.number == i %}
|
{% if results.number == i %}
|
||||||
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
|
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="?page={{ i }}">{{ i }}</a></li>
|
<li><a href="?q={{ query }}&page={{ i }}">{{ i }}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if results.has_next %}
|
{% if results.has_next %}
|
||||||
<li><a href="?page={{ results.next_page_number }}">»</a></li>
|
<li><a href="?q={{ query }}&page={{ results.next_page_number }}">»</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="disabled"><span>»</span></li>
|
<li class="disabled"><span>»</span></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -131,7 +131,10 @@ def search(request):
|
||||||
except EmptyPage:
|
except EmptyPage:
|
||||||
results = paginator.page(paginator.num_pages)
|
results = paginator.page(paginator.num_pages)
|
||||||
|
|
||||||
return render(request, 'results.html', {'results': results})
|
return render(request, 'results.html', {
|
||||||
|
'results': results,
|
||||||
|
'query': q
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class GalleryListViews(ListView):
|
class GalleryListViews(ListView):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user