mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Workaound pour les vues necessitant un paginateur
This commit is contained in:
parent
5575995437
commit
7751c8c263
3 changed files with 4 additions and 4 deletions
|
@ -643,7 +643,7 @@ def control(request):
|
||||||
fields=('control', 'valid'),
|
fields=('control', 'valid'),
|
||||||
extra=0
|
extra=0
|
||||||
)
|
)
|
||||||
invoice_list = re2o_paginator(request, invoice_list, pagination_number)
|
invoice_list = re2o_paginator(request, invoice_list, pagination_number, force_paginate=True)
|
||||||
control_invoices_form = control_invoices_formset(
|
control_invoices_form = control_invoices_formset(
|
||||||
request.POST or None,
|
request.POST or None,
|
||||||
queryset=invoice_list.object_list
|
queryset=invoice_list.object_list
|
||||||
|
|
|
@ -128,7 +128,7 @@ def index(request):
|
||||||
request.GET.get('order'),
|
request.GET.get('order'),
|
||||||
SortTable.LOGS_INDEX
|
SortTable.LOGS_INDEX
|
||||||
)
|
)
|
||||||
versions = re2o_paginator(request, versions, pagination_number)
|
versions = re2o_paginator(request, versions, pagination_number, force_paginate=True)
|
||||||
# Force to have a list instead of QuerySet
|
# Force to have a list instead of QuerySet
|
||||||
versions.count(0)
|
versions.count(0)
|
||||||
# Items to remove later because invalid
|
# Items to remove later because invalid
|
||||||
|
|
|
@ -292,12 +292,12 @@ class SortTable:
|
||||||
return request
|
return request
|
||||||
|
|
||||||
|
|
||||||
def re2o_paginator(request, query_set, pagination_number):
|
def re2o_paginator(request, query_set, pagination_number, force_paginate=False):
|
||||||
"""Paginator script for list display in re2o.
|
"""Paginator script for list display in re2o.
|
||||||
:request:
|
:request:
|
||||||
:query_set: Query_set to paginate
|
:query_set: Query_set to paginate
|
||||||
:pagination_number: Number of entries to display"""
|
:pagination_number: Number of entries to display"""
|
||||||
if query_set.count() > pagination_number:
|
if force_paginate or query_set.count() > pagination_number:
|
||||||
paginator = Paginator(query_set, pagination_number)
|
paginator = Paginator(query_set, pagination_number)
|
||||||
page = request.GET.get('page')
|
page = request.GET.get('page')
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue