fix pagination

This commit is contained in:
j 2017-12-19 10:59:37 +01:00
parent fcfbc77143
commit cedc3fec64
2 changed files with 8 additions and 5 deletions

View File

@ -47,7 +47,7 @@
<div class="small-4 small-offset-4 columns">
<ul class="pagination">
{% if results.has_previous %}
<li><a href="?page={{ results.previous_page_number }}">&laquo;</a></li>
<li><a href="?q={{ query }}&page={{ results.previous_page_number }}">&laquo;</a></li>
{% else %}
<li class="disabled"><span>&laquo;</span></li>
{% endif %}
@ -55,11 +55,11 @@
{% if results.number == i %}
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li><a href="?page={{ i }}">{{ i }}</a></li>
<li><a href="?q={{ query }}&page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if results.has_next %}
<li><a href="?page={{ results.next_page_number }}">&raquo;</a></li>
<li><a href="?q={{ query }}&page={{ results.next_page_number }}">&raquo;</a></li>
{% else %}
<li class="disabled"><span>&raquo;</span></li>
{% endif %}

View File

@ -108,7 +108,7 @@ def texts(request, shortname=None):
return render(request, 'texts.html', {
'texts': texts,
'latest_content_list': latest_content_list,
'gallery':gallery
'gallery': gallery
})
@ -131,7 +131,10 @@ def search(request):
except EmptyPage:
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):