From 59fb628ced3141e90f51db64fb0baafad886a9af Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 29 Aug 2023 16:57:09 +0300 Subject: [PATCH 1/6] 0.6.0 SubscribesApp --- SubscribesApp/admin.py | 88 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/SubscribesApp/admin.py b/SubscribesApp/admin.py index 8c38f3f..a58e82f 100644 --- a/SubscribesApp/admin.py +++ b/SubscribesApp/admin.py @@ -1,3 +1,89 @@ +from sets.admin import * +from .models import * from django.contrib import admin -# Register your models here. +class Admin_Subscribe(Admin_Trans_BaseModel): + fieldsets = ( + (None, { + 'classes': ['wide'], + 'fields': ('name', + ('price'), + 'options', + 'period_name', 'period', + 'order' + ) + }), + ) + + list_display = [ + 'id', + 'name', 'price', + 'period_name', 'period', + 'order', 'modifiedDT', 'createDT' + ] + + list_display_links = ['id'] + + list_filter = ['modifiedDT', 'createDT'] + search_fields = ['name', 'period_name'] + filter_horizontal = ['options'] + +admin.site.register(Subscribe,Admin_Subscribe) + + +class Admin_SubscribeOption(Admin_Trans_BaseModel): + fieldsets = ( + (None, { + 'classes': ['wide'], + 'fields': ('name', + 'order' + ) + }), + ) + + list_display = [ + 'id', + 'name', + 'order', 'modifiedDT', 'createDT' + ] + + list_display_links = ['id'] + + list_filter = ['modifiedDT', 'createDT'] + search_fields = ['name'] + +admin.site.register(SubscribeOption,Admin_SubscribeOption) + + +class Admin_SubscribeForUser(Admin_Trans_BaseModel): + fieldsets = ( + (None, { + 'classes': ['wide'], + 'fields': ('name', + 'user', 'subscribe', + 'last_paid_DT', + 'paid_period_from_DT', 'paid_period_to_DT', + 'auto_continue', 'receive_finish_subscribe_msg', + 'order' + ) + }), + ) + + list_display = [ + 'id', + 'name', 'user', 'subscribe', + 'last_paid_DT', 'paid_period_from_DT', 'paid_period_to_DT', + 'auto_continue', 'receive_finish_subscribe_msg', + 'order', 'modifiedDT', 'createDT' + ] + + list_display_links = ['id'] + + list_filter = [ + 'subscribe', 'last_paid_DT', 'paid_period_from_DT', 'paid_period_to_DT', + 'auto_continue', 'receive_finish_subscribe_msg', + 'modifiedDT', 'createDT' + ] + search_fields = ['name'] + +admin.site.register(SubscribeForUser,Admin_SubscribeForUser) \ No newline at end of file From fdeb2a4ae16b1ff4a41bf10338cb80a75ac814b7 Mon Sep 17 00:00:00 2001 From: borissedw Date: Tue, 29 Aug 2023 17:05:10 +0300 Subject: [PATCH 2/6] 0.0.193 --- static/js/dynamic_loading_routes.js | 46 ++++++++++++++++++++--- templates/pages/p_results_find_route.html | 20 +++++----- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js index 82488c0..d1f6172 100644 --- a/static/js/dynamic_loading_routes.js +++ b/static/js/dynamic_loading_routes.js @@ -2,6 +2,41 @@ let page_iterator = 2 function load_routes (el) { + let number_last_route = el.id + let data = { + 'from_el':parseInt(number_last_route) + 1, + 'to_el':parseInt(number_last_route) + 11 + } + let list_of_elements_form = document.querySelectorAll(".el_form_find_route"); + for (let i = 0;i < list_of_elements_form.length;i++) { + // let id_el = list_of_elements_form[i].id + // if (id_el){ + // if (id_el === "") + // } + let name_attr = list_of_elements_form[i].attributes["name"] + let value_el = list_of_elements_form[i].value + if (name_attr) { + if (list_of_elements_form[i].tagName === "INPUT" && list_of_elements_form[i].type === "checkbox"){ + let name_el = name_attr.value + data[name_el] = "" + if (list_of_elements_form[i].checked){ + + if (name_el === "type_transport"){ + let old_val = data["type_transport"] + if (old_val){ + data["type_transport"] = `${data["type_transport"]},${value_el}` + } + } + + data[name_el] = value_el + } + + } else { + let name_el = name_attr.value + data[name_el] = value_el + } + } + } let loader = document.querySelector(".loader_f_loading_routes") loader.classList.toggle("show") el.classList.toggle("hide") @@ -12,11 +47,8 @@ function load_routes (el) { // if (new_el_dataset){ // let number_last_route = new_el_dataset['numberOfRoute'] // let number_last_route = el.dataset['lastRoute'] - let number_last_route = el.id - let data = { - 'from_el':parseInt(number_last_route) + 1, - 'to_el':parseInt(number_last_route) + 11 - } + + $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, url: '/ru/routes/find_routes/', @@ -36,7 +68,9 @@ function load_routes (el) { let old_page_iterator = page_iterator page_iterator++ loader.classList.toggle("show") - el.classList.toggle("hide") + if (!data.last_block_routes){ + el.classList.toggle("hide") + } let el_scroll = place_ins.firstElementChild el_scroll.scrollIntoView( { diff --git a/templates/pages/p_results_find_route.html b/templates/pages/p_results_find_route.html index b02c830..c1de435 100644 --- a/templates/pages/p_results_find_route.html +++ b/templates/pages/p_results_find_route.html @@ -39,6 +39,7 @@ type="number" name="from_address_point" id="id_from_address_point" + class="el_form_find_route" hidden class="disp-none" {% if form.initial.from_address_point %}value="{{ form.initial.from_address_point }}"{% endif %} @@ -77,6 +78,7 @@ type="number" name="to_address_point" id="id_to_address_point" + class="el_form_find_route" hidden class="disp-none" {% if form.initial.to_address_point %}value="{{ form.initial.to_address_point}}"{% endif %}/> @@ -101,15 +103,15 @@
- +
- +
- {% for item in form.fields.cargo_type.choices %} @@ -118,7 +120,7 @@
-
+
@@ -142,7 +144,7 @@ {% if forloop.counter0 > 0 %}
Откуда забрать посылку
- {% for item in form.fields.from_place.choices %} @@ -183,7 +185,7 @@
Куда доставить посылку
- {% for item in form.fields.to_place.choices %} @@ -193,7 +195,7 @@
- +
@@ -204,7 +206,7 @@
Сортировать по:
-
From 2fce92acf8816d288a08e02e6c69ca1900e6f7f4 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 29 Aug 2023 17:06:15 +0300 Subject: [PATCH 3/6] 0.6.1 routes filter pagination --- RoutesApp/funcs.py | 9 ++++++++- RoutesApp/js_views.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/RoutesApp/funcs.py b/RoutesApp/funcs.py index 346847a..f654761 100644 --- a/RoutesApp/funcs.py +++ b/RoutesApp/funcs.py @@ -39,6 +39,8 @@ def get_routes_Dict(user=None, data=None): to_el = int(val) routes = Route.objects.filter(**kwargs).order_by('-modifiedDT') + routes_count = routes.count() + if from_el and to_el: routes = routes[from_el:to_el] elif from_el: @@ -48,6 +50,10 @@ def get_routes_Dict(user=None, data=None): else: routes = routes[:25] + last_block_routes = False + if to_el and to_el >= routes_count: + last_block_routes = True + res_Dict = {} try: @@ -72,7 +78,8 @@ def get_routes_Dict(user=None, data=None): print(msg) res_Dict = { - 'routes': routes + 'routes': routes, + 'last_block_routes': last_block_routes } return res_Dict diff --git a/RoutesApp/js_views.py b/RoutesApp/js_views.py index 53cda2f..e1c97a1 100644 --- a/RoutesApp/js_views.py +++ b/RoutesApp/js_views.py @@ -169,6 +169,7 @@ def find_routes_ajax(request): res_Dict = { 'html': html, + 'last_block_routes': routes_Dict['last_block_routes'] # 'form': RouteForm(initial=data) } From 00799916c669e1c0cc6b3ffe84542115eea11f97 Mon Sep 17 00:00:00 2001 From: borissedw Date: Tue, 29 Aug 2023 17:09:31 +0300 Subject: [PATCH 4/6] 0.0.192 --- static/js/range_slider_double.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/static/js/range_slider_double.js b/static/js/range_slider_double.js index 3384ca4..ef46916 100644 --- a/static/js/range_slider_double.js +++ b/static/js/range_slider_double.js @@ -18,8 +18,8 @@ function inital_slider (){ type: "double", min: min, max: max, - from: 100, - to: 900, + from: 0, + to: 1000, onStart: updateInputs, onChange: updateInputs }); From 63f0fe8dd95319a56715b9257f1d57647dd470d3 Mon Sep 17 00:00:00 2001 From: borissedw Date: Tue, 29 Aug 2023 17:10:35 +0300 Subject: [PATCH 5/6] 0.0.194 --- static/js/dynamic_loading_routes.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js index d1f6172..8d97fc3 100644 --- a/static/js/dynamic_loading_routes.js +++ b/static/js/dynamic_loading_routes.js @@ -71,12 +71,12 @@ function load_routes (el) { if (!data.last_block_routes){ el.classList.toggle("hide") } - let el_scroll = place_ins.firstElementChild - el_scroll.scrollIntoView( - { - behavior:"smooth" - } - ) + // let el_scroll = place_ins.firstElementChild + // el_scroll.scrollIntoView( + // { + // behavior:"smooth" + // } + // ) let new_page_routes = document.createElement("div") new_page_routes.classList.add("page_routes_" + page_iterator) $(new_page_routes).insertAfter(".page_routes_" + old_page_iterator); From 6198ccaa972bed6311785b1019894e8951e56269 Mon Sep 17 00:00:00 2001 From: borissedw Date: Tue, 29 Aug 2023 17:21:17 +0300 Subject: [PATCH 6/6] 0.0.195 --- static/css/styles(boris).css | 7 +++++++ static/js/dynamic_loading_routes.js | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/static/css/styles(boris).css b/static/css/styles(boris).css index bb00b91..6983df4 100644 --- a/static/css/styles(boris).css +++ b/static/css/styles(boris).css @@ -1475,4 +1475,11 @@ } .loader_f_loading_routes.show{ display: block; +} + +.line_separator_page_w_el{ + width: 100%; + border-bottom: 1px solid #919BA5; + margin-top: 30px; + margin-bottom: 30px; } \ No newline at end of file diff --git a/static/js/dynamic_loading_routes.js b/static/js/dynamic_loading_routes.js index 8d97fc3..5f35f71 100644 --- a/static/js/dynamic_loading_routes.js +++ b/static/js/dynamic_loading_routes.js @@ -1,5 +1,5 @@ let page_iterator = 2 - +let separator_iterator = 1 function load_routes (el) { let number_last_route = el.id @@ -80,8 +80,12 @@ function load_routes (el) { let new_page_routes = document.createElement("div") new_page_routes.classList.add("page_routes_" + page_iterator) $(new_page_routes).insertAfter(".page_routes_" + old_page_iterator); + let line_separator = document.createElement("div") + line_separator.classList.add("line_separator_page_w_el") + $(line_separator).insertAfter(".page_routes_" + separator_iterator); // document.querySelector(".info_profile").innerHTML = data.html; el.setAttribute("id",parseInt(number_last_route) + 11) + separator_iterator++ // number_last_route = parseInt(number_last_route) + "11" }, error: function (data){