From 3a911d928fbc656439c657b1fc5765c9e4896b83 Mon Sep 17 00:00:00 2001 From: SDE Date: Tue, 7 May 2024 18:51:17 +0300 Subject: [PATCH] 1.0.4 subscribe page w dynamically load --- BillingApp/admin.py | 1 + SubscribesApp/funcs.py | 6 ++++-- templates/blocks/profile/b_subscribe_current.html | 8 +++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/BillingApp/admin.py b/BillingApp/admin.py index 0027da2..1ace31e 100644 --- a/BillingApp/admin.py +++ b/BillingApp/admin.py @@ -13,6 +13,7 @@ class Admin_SubscribeOrder(Admin_BaseModel): ('sum', 'currency'), ('status', 'last_operation_status'), ('bank_order_id', 'pay_page'), + 'json_data', ) }), ) diff --git a/SubscribesApp/funcs.py b/SubscribesApp/funcs.py index 4ffe96f..c22eb08 100644 --- a/SubscribesApp/funcs.py +++ b/SubscribesApp/funcs.py @@ -28,7 +28,7 @@ def get_subscribes_w_options(): def check_n_enable_subscribe_by_order(order): - subscribes_for_user = SubscribeForUser.objects.filter(user=order.user) + subscribes_for_user = []#SubscribeForUser.objects.filter(user=order.user) if order and order.enable and order.status == 'charged': kwargs = { @@ -80,7 +80,9 @@ def get_profile_subscribe_page_content_Dict(request): error = f'{order.status}' if 'status' in order.json_data and 'failure_message' in order.json_data['status']: error = f'{error} ({order.json_data["status"]["failure_message"]})' - subscribes.get(id=order.subscribe.id).order_error = error + for subscribe in subscribes: + if subscribe == order.subscribe: + subscribe.order_error = error check_orders_required = False else: check_orders_required = True diff --git a/templates/blocks/profile/b_subscribe_current.html b/templates/blocks/profile/b_subscribe_current.html index 66f33b9..b75e46e 100644 --- a/templates/blocks/profile/b_subscribe_current.html +++ b/templates/blocks/profile/b_subscribe_current.html @@ -76,8 +76,14 @@
{% translate "Период" %}: {{ item.period_name }}
- + + {% if item.order_error %} +
+
Ошибка оплаты
+
{{ item.order_error }}
+
+ {% endif %} {% endif %}