diff --git a/boards/templates/boards/all_threads.html b/boards/templates/boards/all_threads.html
--- a/boards/templates/boards/all_threads.html
+++ b/boards/templates/boards/all_threads.html
@@ -1,4 +1,4 @@
-{% extends "boards/base.html" %}
+{% extends "boards/paginated.html" %}
{% load i18n %}
{% load board %}
diff --git a/boards/templates/boards/feed.html b/boards/templates/boards/feed.html
--- a/boards/templates/boards/feed.html
+++ b/boards/templates/boards/feed.html
@@ -1,4 +1,4 @@
-{% extends "boards/base.html" %}
+{% extends "boards/paginated.html" %}
{% load i18n %}
{% load board %}
@@ -50,24 +50,3 @@
{% endif %}
{% endblock %}
-{% block metapanel %}
-
-
- {% trans "Pages:" %}
- [
- {% with dividers=paginator.get_dividers %}
- {% for page in paginator.get_divided_range %}
- {% if page in dividers %}
- …,
- {% endif %}
- {{ page }} {% if not forloop.last %},{% endif %}
- {% endfor %}
- {% endwith %}
- ]
-
-
-{% endblock %}
diff --git a/boards/templates/boards/paginated.html b/boards/templates/boards/paginated.html
new file mode 100644
--- /dev/null
+++ b/boards/templates/boards/paginated.html
@@ -0,0 +1,26 @@
+{% extends 'boards/base.html' %}
+
+{% load i18n %}
+{% load board %}
+
+{% block metapanel %}
+
+
+ {% trans "Pages:" %}
+ [
+ {% with dividers=paginator.get_dividers %}
+ {% for page in paginator.get_divided_range %}
+ {% if page in dividers %}
+ …,
+ {% endif %}
+ {{ page }} {% if not forloop.last %},{% endif %}
+ {% endfor %}
+ {% endwith %}
+ ]
+
+
+{% endblock %}
diff --git a/boards/templates/search/search.html b/boards/templates/search/search.html
--- a/boards/templates/search/search.html
+++ b/boards/templates/search/search.html
@@ -1,4 +1,4 @@
-{% extends 'boards/base.html' %}
+{% extends 'boards/paginated.html' %}
{% load board %}
{% load i18n %}
@@ -6,6 +6,13 @@
{% block head %}
{% trans 'Search' %} - {{ site_name }}
+
+ {% if prev_page_link %}
+
+ {% endif %}
+ {% if next_page_link %}
+
+ {% endif %}
{% endblock %}
{% block content %}
@@ -20,23 +27,22 @@
- {% if page %}
- {% if page.has_previous %}
+ {% if current_page %}
+ {% if prev_page_link %}
{% endif %}
- {% for result in page.object_list %}
+ {% for result in current_page.object_list %}
{% post_view result truncated=True need_op_data=True %}
{% endfor %}
- {% if page.has_next %}
+ {% if next_page_link %}
{% endif %}
{% endif %}
{% endblock %}
+
diff --git a/boards/views/search.py b/boards/views/search.py
--- a/boards/views/search.py
+++ b/boards/views/search.py
@@ -1,10 +1,12 @@
from django.shortcuts import render
from django.views.generic import View
from django.db.models import Q
+from django.core.urlresolvers import reverse
from boards.abstracts.paginator import get_paginator
from boards.forms import SearchForm, PlainErrorList
from boards.models import Post
+from boards.views.mixins import PaginatedMixin
MIN_QUERY_LENGTH = 3
@@ -23,7 +25,7 @@ REQUEST_PAGE = 'page'
TEMPLATE = 'search/search.html'
-class BoardSearchView(View):
+class BoardSearchView(View, PaginatedMixin):
def get(self, request):
params = dict()
@@ -37,10 +39,11 @@ class BoardSearchView(View):
| Q(title__icontains=query) | Q(opening=True,
thread__tags__aliases__name__icontains=query)).order_by('-id').distinct()
paginator = get_paginator(results, RESULTS_PER_PAGE)
+ paginator.set_url(reverse('search'), request.GET.dict())
page = int(request.GET.get(REQUEST_PAGE, '1'))
- params[CONTEXT_PAGE] = paginator.page(page)
params[CONTEXT_QUERY] = query
+ params.update(self.get_page_context(paginator, page))
return render(request, TEMPLATE, params)