routes filter pagination
This commit is contained in:
SDE
2023-08-29 17:06:15 +03:00
parent fdeb2a4ae1
commit 2fce92acf8
2 changed files with 9 additions and 1 deletions

View File

@@ -39,6 +39,8 @@ def get_routes_Dict(user=None, data=None):
to_el = int(val) to_el = int(val)
routes = Route.objects.filter(**kwargs).order_by('-modifiedDT') routes = Route.objects.filter(**kwargs).order_by('-modifiedDT')
routes_count = routes.count()
if from_el and to_el: if from_el and to_el:
routes = routes[from_el:to_el] routes = routes[from_el:to_el]
elif from_el: elif from_el:
@@ -48,6 +50,10 @@ def get_routes_Dict(user=None, data=None):
else: else:
routes = routes[:25] routes = routes[:25]
last_block_routes = False
if to_el and to_el >= routes_count:
last_block_routes = True
res_Dict = {} res_Dict = {}
try: try:
@@ -72,7 +78,8 @@ def get_routes_Dict(user=None, data=None):
print(msg) print(msg)
res_Dict = { res_Dict = {
'routes': routes 'routes': routes,
'last_block_routes': last_block_routes
} }
return res_Dict return res_Dict

View File

@@ -169,6 +169,7 @@ def find_routes_ajax(request):
res_Dict = { res_Dict = {
'html': html, 'html': html,
'last_block_routes': routes_Dict['last_block_routes']
# 'form': RouteForm(initial=data) # 'form': RouteForm(initial=data)
} }