8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Workaound pour les vues necessitant un paginateur

This commit is contained in:
Gabriel Detraz 2018-05-03 14:40:15 +02:00 committed by chirac
parent 5575995437
commit 7751c8c263
3 changed files with 4 additions and 4 deletions

View file

@ -643,7 +643,7 @@ def control(request):
fields=('control', 'valid'),
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(
request.POST or None,
queryset=invoice_list.object_list

View file

@ -128,7 +128,7 @@ def index(request):
request.GET.get('order'),
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
versions.count(0)
# Items to remove later because invalid

View file

@ -292,12 +292,12 @@ class SortTable:
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.
:request:
:query_set: Query_set to paginate
: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)
page = request.GET.get('page')
try: