routes paging
This commit is contained in:
SDE
2023-11-29 16:52:20 +03:00
parent dfec56fef9
commit fc1654dedb
4 changed files with 16 additions and 7 deletions

View File

@@ -4,6 +4,9 @@ from django.utils.translation import gettext as _
from django.template.loader import render_to_string
from datetime import datetime
elements_on_page = 25
def get_profile_new_route_page_html(request, data):
form = RouteForm()
@@ -199,14 +202,17 @@ def get_routes_Dict(user=None, data=None):
elif to_el:
routes = routes[:to_el]
else:
to_el = 25
to_el = elements_on_page
routes = routes[:to_el]
last_block = False
if not to_el or to_el >= routes_count:
last_block = True
if routes_count - to_el > elements_on_page:
next_page_els_count = elements_on_page
else:
next_page_els_count = routes_count - to_el
try:
@@ -232,7 +238,8 @@ def get_routes_Dict(user=None, data=None):
res_Dict.update({
'routes': routes,
'last_block': last_block,
'last_el': to_el
'last_el': to_el,
'next_page_els_count': next_page_els_count
})
return res_Dict