File tree Expand file tree Collapse file tree 3 files changed +44
-3
lines changed
Expand file tree Collapse file tree 3 files changed +44
-3
lines changed Original file line number Diff line number Diff line change 1818 {{ page_obj.paginator.count|intcomma }} results
1919 </ div >
2020 {% if is_paginated %}
21- {% include 'includes/pagination .html' with page_obj=page_obj %}
21+ {% include 'includes/rules_pagination .html' with page_obj=page_obj %}
2222 {% endif %}
2323 </ div >
2424 </ section >
5858
5959
6060 {% if is_paginated %}
61- {% include 'includes/pagination .html' with page_obj=page_obj %}
61+ {% include 'includes/rules_pagination .html' with page_obj=page_obj %}
6262 {% endif %}
6363 </ section >
6464
Original file line number Diff line number Diff line change 1+ < nav class ="pagination is-centered is-small " aria-label ="pagination ">
2+ {% if page_obj.has_previous %}
3+ < a href ="{% querystring page=page_obj.previous_page_number %} " class ="pagination-previous "> Previous</ a >
4+ {% else %}
5+ < a class ="pagination-previous "> Previous</ a >
6+ {% endif %}
7+
8+ {% if page_obj.has_next %}
9+ < a href ="{% querystring page=page_obj.next_page_number %} " class ="pagination-next "> Next</ a >
10+ {% else %}
11+ < a class ="pagination-next "> Next</ a >
12+ {% endif %}
13+
14+ < ul class ="pagination-list ">
15+ {% for page_num in elided_page_range %}
16+ {% if page_num == page_obj.paginator.ELLIPSIS %}
17+ < li >
18+ < span class ="pagination-ellipsis "> …</ span >
19+ </ li >
20+ {% elif page_num == page_obj.number %}
21+ < li >
22+ < a class ="pagination-link is-current "
23+ aria-label ="Page {{ page_num }} "
24+ aria-current ="page "> {{ page_num }}
25+ </ a >
26+ </ li >
27+ {% else %}
28+ < li >
29+ < a href ="{% querystring page=page_num %} "
30+ class ="pagination-link "
31+ aria-label ="Goto page {{ page_num }} "> {{ page_num }}</ a >
32+ </ li >
33+ {% endif %}
34+ {% endfor %}
35+ </ ul >
36+
37+ </ nav >
Original file line number Diff line number Diff line change 1919from django .db .models import F
2020from django .db .models import Prefetch
2121from django .db .models import Q
22+ from django .http import QueryDict
2223from django .http .response import Http404
2324from django .shortcuts import get_object_or_404
2425from django .shortcuts import redirect
@@ -152,7 +153,10 @@ def get_context_data(self, **kwargs):
152153 context = super ().get_context_data (** kwargs )
153154 request_query = self .request .GET
154155 context ["detection_search_form" ] = DetectionRuleSearchForm (request_query )
155- context ["search" ] = request_query .get ("search" )
156+ page_obj = context ["page_obj" ]
157+ context ["elided_page_range" ] = page_obj .paginator .get_elided_page_range (
158+ page_obj .number , on_each_side = 2 , on_ends = 1
159+ )
156160 return context
157161
158162 def get_queryset (self ):
You can’t perform that action at this time.
0 commit comments