Show More
@@ -0,0 +1,26 b'' | |||
|
1 | {% extends 'boards/base.html' %} | |
|
2 | ||
|
3 | {% load i18n %} | |
|
4 | {% load board %} | |
|
5 | ||
|
6 | {% block metapanel %} | |
|
7 | ||
|
8 | <span class="metapanel"> | |
|
9 | {% trans "Pages:" %} | |
|
10 | [ | |
|
11 | {% with dividers=paginator.get_dividers %} | |
|
12 | {% for page in paginator.get_divided_range %} | |
|
13 | {% if page in dividers %} | |
|
14 | …, | |
|
15 | {% endif %} | |
|
16 | <a | |
|
17 | {% ifequal page current_page.number %} | |
|
18 | class="current_page" | |
|
19 | {% endifequal %} | |
|
20 | href="{% page_url paginator page %}">{{ page }}</a>{% if not forloop.last %},{% endif %} | |
|
21 | {% endfor %} | |
|
22 | {% endwith %} | |
|
23 | ] | |
|
24 | </span> | |
|
25 | ||
|
26 | {% endblock %} |
@@ -1,4 +1,4 b'' | |||
|
1 |
{% extends "boards/ |
|
|
1 | {% extends "boards/paginated.html" %} | |
|
2 | 2 | |
|
3 | 3 | {% load i18n %} |
|
4 | 4 | {% load board %} |
@@ -1,4 +1,4 b'' | |||
|
1 |
{% extends "boards/ |
|
|
1 | {% extends "boards/paginated.html" %} | |
|
2 | 2 | |
|
3 | 3 | {% load i18n %} |
|
4 | 4 | {% load board %} |
@@ -50,24 +50,3 b'' | |||
|
50 | 50 | {% endif %} |
|
51 | 51 | {% endblock %} |
|
52 | 52 | |
|
53 | {% block metapanel %} | |
|
54 | ||
|
55 | <span class="metapanel"> | |
|
56 | {% trans "Pages:" %} | |
|
57 | [ | |
|
58 | {% with dividers=paginator.get_dividers %} | |
|
59 | {% for page in paginator.get_divided_range %} | |
|
60 | {% if page in dividers %} | |
|
61 | …, | |
|
62 | {% endif %} | |
|
63 | <a | |
|
64 | {% ifequal page current_page.number %} | |
|
65 | class="current_page" | |
|
66 | {% endifequal %} | |
|
67 | href="{% page_url paginator page %}">{{ page }}</a>{% if not forloop.last %},{% endif %} | |
|
68 | {% endfor %} | |
|
69 | {% endwith %} | |
|
70 | ] | |
|
71 | </span> | |
|
72 | ||
|
73 | {% endblock %} |
@@ -1,4 +1,4 b'' | |||
|
1 |
{% extends 'boards/ |
|
|
1 | {% extends 'boards/paginated.html' %} | |
|
2 | 2 | |
|
3 | 3 | {% load board %} |
|
4 | 4 | {% load i18n %} |
@@ -6,6 +6,13 b'' | |||
|
6 | 6 | {% block head %} |
|
7 | 7 | <title>{% trans 'Search' %} - {{ site_name }}</title> |
|
8 | 8 | <meta name="robots" content="noindex"> |
|
9 | ||
|
10 | {% if prev_page_link %} | |
|
11 | <link rel="prev" href="{{ prev_page_link }}" /> | |
|
12 | {% endif %} | |
|
13 | {% if next_page_link %} | |
|
14 | <link rel="next" href="{{ next_page_link }}" /> | |
|
15 | {% endif %} | |
|
9 | 16 | {% endblock %} |
|
10 | 17 | |
|
11 | 18 | {% block content %} |
@@ -20,23 +27,22 b'' | |||
|
20 | 27 | </div> |
|
21 | 28 | </div> |
|
22 | 29 | |
|
23 | {% if page %} | |
|
24 |
{% if p |
|
|
30 | {% if current_page %} | |
|
31 | {% if prev_page_link %} | |
|
25 | 32 | <div class="page_link"> |
|
26 |
<a href=" |
|
|
27 | </a> | |
|
33 | <a href="{{ prev_page_link }}"><< {% trans "Previous page" %} <<</a> | |
|
28 | 34 | </div> |
|
29 | 35 | {% endif %} |
|
30 | 36 | |
|
31 | {% for result in page.object_list %} | |
|
37 | {% for result in current_page.object_list %} | |
|
32 | 38 | {% post_view result truncated=True need_op_data=True %} |
|
33 | 39 | {% endfor %} |
|
34 | 40 | |
|
35 |
{% if |
|
|
41 | {% if next_page_link %} | |
|
36 | 42 | <div class="page_link"> |
|
37 |
<a href=" |
|
|
38 | </a> | |
|
43 | <a href="{{ next_page_link }}">>> {% trans "Next page" %} >></a> | |
|
39 | 44 | </div> |
|
40 | 45 | {% endif %} |
|
41 | 46 | {% endif %} |
|
42 | 47 | {% endblock %} |
|
48 |
@@ -1,10 +1,12 b'' | |||
|
1 | 1 | from django.shortcuts import render |
|
2 | 2 | from django.views.generic import View |
|
3 | 3 | from django.db.models import Q |
|
4 | from django.core.urlresolvers import reverse | |
|
4 | 5 | |
|
5 | 6 | from boards.abstracts.paginator import get_paginator |
|
6 | 7 | from boards.forms import SearchForm, PlainErrorList |
|
7 | 8 | from boards.models import Post |
|
9 | from boards.views.mixins import PaginatedMixin | |
|
8 | 10 | |
|
9 | 11 | |
|
10 | 12 | MIN_QUERY_LENGTH = 3 |
@@ -23,7 +25,7 b" REQUEST_PAGE = 'page'" | |||
|
23 | 25 | TEMPLATE = 'search/search.html' |
|
24 | 26 | |
|
25 | 27 | |
|
26 | class BoardSearchView(View): | |
|
28 | class BoardSearchView(View, PaginatedMixin): | |
|
27 | 29 | def get(self, request): |
|
28 | 30 | params = dict() |
|
29 | 31 | |
@@ -37,10 +39,11 b' class BoardSearchView(View):' | |||
|
37 | 39 | | Q(title__icontains=query) | Q(opening=True, |
|
38 | 40 | thread__tags__aliases__name__icontains=query)).order_by('-id').distinct() |
|
39 | 41 | paginator = get_paginator(results, RESULTS_PER_PAGE) |
|
42 | paginator.set_url(reverse('search'), request.GET.dict()) | |
|
40 | 43 | |
|
41 | 44 | page = int(request.GET.get(REQUEST_PAGE, '1')) |
|
42 | 45 | |
|
43 | params[CONTEXT_PAGE] = paginator.page(page) | |
|
44 | 46 | params[CONTEXT_QUERY] = query |
|
47 | params.update(self.get_page_context(paginator, page)) | |
|
45 | 48 | |
|
46 | 49 | return render(request, TEMPLATE, params) |
General Comments 0
You need to be logged in to leave comments.
Login now