From ac60b08f2d07cf733ab281cee9ef06e81cc951ee Mon Sep 17 00:00:00 2001 From: SBD Date: Wed, 29 Nov 2023 16:26:00 +0300 Subject: [PATCH 1/8] 0.8.420 --- BaseModels/paging.py | 6 +++--- static/js/dynamic_loading_routes.js | 14 +++++++++----- templates/blocks/b_find_route_form.html | 4 ++-- templates/pages/p_articles.html | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/BaseModels/paging.py b/BaseModels/paging.py index d1f8168..b80f121 100644 --- a/BaseModels/paging.py +++ b/BaseModels/paging.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- __author__ = 'SDE' -def get_paging_Dict(request, elements_count, elements_on_page, from_page, to_page=None): +def get_paging_Dict(request, elements_count, next_page_els_count, from_page, to_page=None): - pages_count = elements_count / elements_on_page - if elements_count % elements_on_page > 0: + pages_count = elements_count / next_page_els_count + if elements_count % next_page_els_count > 0: pages_count = pages_count + 1 pages = [] diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js index 0f76d95..d43eb85 100644 --- a/static/js/dynamic_loading_routes.js +++ b/static/js/dynamic_loading_routes.js @@ -3,16 +3,16 @@ standart_page_iterator = 1 separator_iterator = 1 iterator_f_check = 1 -function load_routes (el,news=null) { +function load_routes (el,news=null,incrase) { let local_page_iterator = standart_page_iterator if (!news){ local_page_iterator = page_iterator } let number_last_route = el.id - let incrase = 2 - if (!news){ - incrase = 10 - } + // let incrase = 2 + // if (!news){ + // incrase = 10 + // } let data_d = { 'from_el':parseInt(number_last_route), 'to_el':parseInt(number_last_route) + incrase @@ -58,6 +58,10 @@ function load_routes (el,news=null) { // // + if (data.next_page_els_count){ + document.querySelector(".col_vo_els_f_load").innerHTML = data.next_page_els_count + } + let place_ins_parent = el.closest(".block_w_paging") let place_ins = place_ins_parent.querySelector(`.page_paging_elements_${local_page_iterator}`) // diff --git a/templates/blocks/b_find_route_form.html b/templates/blocks/b_find_route_form.html index d4a0a47..b1a1d9a 100644 --- a/templates/blocks/b_find_route_form.html +++ b/templates/blocks/b_find_route_form.html @@ -19,9 +19,9 @@
- {% if last_block == False %} + {% if last_block == False and next_page_els_count %}
- +
diff --git a/templates/pages/p_articles.html b/templates/pages/p_articles.html index df360bf..37694e8 100644 --- a/templates/pages/p_articles.html +++ b/templates/pages/p_articles.html @@ -36,10 +36,10 @@ {% include 'blocks/articles/b_news_elements_content.html' %} {% endwith %} {# boris edited #} - {% if last_block == False %} + {% if last_block == False and next_page_els_count %}
{% csrf_token %} - +
From 66fbf984e9c91286631d2b6cb985bcf3b7fb1a60 Mon Sep 17 00:00:00 2001 From: SDE Date: Wed, 29 Nov 2023 16:29:48 +0300 Subject: [PATCH 2/8] 0.7.87 articles paging --- ArticlesApp/funcs.py | 10 +++++++++- ArticlesApp/views.py | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ArticlesApp/funcs.py b/ArticlesApp/funcs.py index ec356b5..2f00cab 100644 --- a/ArticlesApp/funcs.py +++ b/ArticlesApp/funcs.py @@ -1,6 +1,8 @@ from .models import * +elements_on_page = 2 + def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): if request_Data: @@ -27,10 +29,16 @@ def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): if not to_el or to_el >= el_count: last_block = True + if el_count - to_el > elements_on_page: + next_page_els_count = elements_on_page + else: + next_page_els_count = el_count - to_el + Dict = { 'articles': arts, 'last_block': last_block, - 'last_el': to_el + 'last_el': to_el, + 'next_page_els_count': next_page_els_count } return Dict diff --git a/ArticlesApp/views.py b/ArticlesApp/views.py index 735532c..ea4f70c 100644 --- a/ArticlesApp/views.py +++ b/ArticlesApp/views.py @@ -79,6 +79,9 @@ def ArticlesPageView(request, year=None): Dict = get_articles(art_kwargs=kwargs) + Dict.update({ + + }) t = loader.get_template('pages/p_articles.html') return get_inter_http_respose(t, Dict, request) From 4400a6b13fcdf26bdb16a02702e72577cb551ec4 Mon Sep 17 00:00:00 2001 From: SDE Date: Wed, 29 Nov 2023 16:33:21 +0300 Subject: [PATCH 3/8] 0.7.88 articles paging --- ArticlesApp/js_views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ArticlesApp/js_views.py b/ArticlesApp/js_views.py index eccc45f..f82bf78 100644 --- a/ArticlesApp/js_views.py +++ b/ArticlesApp/js_views.py @@ -37,7 +37,8 @@ def get_articles_block_ajax(request): res_Dict = { 'html': html, - 'last_block': Dict['last_block'] + 'last_block': Dict['last_block'], + 'next_page_els_count': Dict['next_page_els_count'], # 'form': RouteForm(initial=data) } From c1ccf003024ff2dfc716e4dd3d2dc98c4a41341e Mon Sep 17 00:00:00 2001 From: SBD Date: Wed, 29 Nov 2023 16:33:28 +0300 Subject: [PATCH 4/8] 0.8.421 --- templates/blocks/b_find_route_form.html | 2 +- templates/pages/p_articles.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/blocks/b_find_route_form.html b/templates/blocks/b_find_route_form.html index b1a1d9a..d4e4ed1 100644 --- a/templates/blocks/b_find_route_form.html +++ b/templates/blocks/b_find_route_form.html @@ -21,7 +21,7 @@ {% if last_block == False and next_page_els_count %}
- +
diff --git a/templates/pages/p_articles.html b/templates/pages/p_articles.html index 37694e8..ada10c8 100644 --- a/templates/pages/p_articles.html +++ b/templates/pages/p_articles.html @@ -39,7 +39,7 @@ {% if last_block == False and next_page_els_count %}
{% csrf_token %} - +
From 3a0845fe2af06d94ae90b8bfcacdc790bbef26fe Mon Sep 17 00:00:00 2001 From: SBD Date: Wed, 29 Nov 2023 16:34:30 +0300 Subject: [PATCH 5/8] 0.8.422 --- static/js/dynamic_loading_routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js index d43eb85..87b4fb8 100644 --- a/static/js/dynamic_loading_routes.js +++ b/static/js/dynamic_loading_routes.js @@ -59,7 +59,7 @@ function load_routes (el,news=null,incrase) { // if (data.next_page_els_count){ - document.querySelector(".col_vo_els_f_load").innerHTML = data.next_page_els_count + document.querySelector(".col_vo_els_f_load").innerHTML = ` ${data.next_page_els_count}` } let place_ins_parent = el.closest(".block_w_paging") From d4562e7ca45ea9053d0d2b537c91431be58f37d9 Mon Sep 17 00:00:00 2001 From: SDE Date: Wed, 29 Nov 2023 16:36:10 +0300 Subject: [PATCH 6/8] 0.7.89 articles paging --- ArticlesApp/funcs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArticlesApp/funcs.py b/ArticlesApp/funcs.py index 2f00cab..e1bbfc2 100644 --- a/ArticlesApp/funcs.py +++ b/ArticlesApp/funcs.py @@ -1,7 +1,7 @@ from .models import * -elements_on_page = 2 +elements_on_page = 10 def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): From dfec56fef9d473605ae58c1c17c992915cf15b32 Mon Sep 17 00:00:00 2001 From: SDE Date: Wed, 29 Nov 2023 16:38:12 +0300 Subject: [PATCH 7/8] 0.7.90 articles paging --- ArticlesApp/funcs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArticlesApp/funcs.py b/ArticlesApp/funcs.py index e1bbfc2..3331ecb 100644 --- a/ArticlesApp/funcs.py +++ b/ArticlesApp/funcs.py @@ -22,7 +22,7 @@ def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): elif to_el: arts = arts[:to_el] else: - to_el = 3 + to_el = elements_on_page + 1 arts = arts[:to_el] last_block = False From fc1654dedb99dbe6e0528a6ba67fd2dbdabcdfee Mon Sep 17 00:00:00 2001 From: SDE Date: Wed, 29 Nov 2023 16:52:20 +0300 Subject: [PATCH 8/8] 0.7.91 routes paging --- ArticlesApp/funcs.py | 4 ++-- RoutesApp/funcs.py | 13 ++++++++++--- RoutesApp/js_views.py | 3 ++- RoutesApp/views.py | 3 ++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ArticlesApp/funcs.py b/ArticlesApp/funcs.py index 3331ecb..2d92211 100644 --- a/ArticlesApp/funcs.py +++ b/ArticlesApp/funcs.py @@ -1,7 +1,7 @@ from .models import * -elements_on_page = 10 +elements_on_page = 4 def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): @@ -22,7 +22,7 @@ def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): elif to_el: arts = arts[:to_el] else: - to_el = elements_on_page + 1 + to_el = elements_on_page arts = arts[:to_el] last_block = False diff --git a/RoutesApp/funcs.py b/RoutesApp/funcs.py index 481bf6a..0cd4c08 100644 --- a/RoutesApp/funcs.py +++ b/RoutesApp/funcs.py @@ -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 diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py index 68dc8c2..3e57579 100644 --- a/RoutesApp/js_views.py +++ b/RoutesApp/js_views.py @@ -148,7 +148,8 @@ def find_routes_ajax(request): res_Dict = { 'html': html, - 'last_block': routes_Dict['last_block'] + 'last_block': routes_Dict['last_block'], + 'next_page_els_count': routes_Dict['next_page_els_count'], # 'form': RouteForm(initial=data) } diff --git a/RoutesApp/views.py b/RoutesApp/views.py index 19fab4e..d6163ef 100644 --- a/RoutesApp/views.py +++ b/RoutesApp/views.py @@ -32,7 +32,8 @@ def route_search_results_View(request): 'show_filter_and_results': True, 'owner_type': data['owner_type'], 'last_el': routes_Dict['last_el'], - 'page_type': 'routes' + 'page_type': 'routes', + 'next_page_els_count': routes_Dict['next_page_els_count'], } if 'from_address_point_txt' in routes_Dict: data.update({'from_address_point_txt': routes_Dict['from_address_point_txt']})