From 8f7127f0fbeebb7d967847287497ca68073c7cb3 Mon Sep 17 00:00:00 2001 From: duker33 Date: Sat, 25 Aug 2018 11:51:06 +0300 Subject: [PATCH] #543 Add log to ya aviso view. Change order list fields set at admin panel (#544) --- shopelectro/admin.py | 3 ++- shopelectro/views/service.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/shopelectro/admin.py b/shopelectro/admin.py index 0a9441f7..2d7072f9 100644 --- a/shopelectro/admin.py +++ b/shopelectro/admin.py @@ -238,10 +238,11 @@ class OrderAdmin(mixins.PermissionsControl): add = False inlines = [PositionInline] - list_display = ['name', 'email', 'phone', 'address', 'city', 'payment_type', 'paid'] + list_display = ['id', 'name', 'email', 'phone', 'total_price', 'payment_type', 'paid'] search_fields = ['name', 'email', 'phone'] list_display_links = ['name'] + se_admin = SEAdminSite(name='se_admin') se_admin.register(CustomPage, models.CustomPageAdmin) se_admin.register(FlatPage, models.FlatPageAdmin) diff --git a/shopelectro/views/service.py b/shopelectro/views/service.py index 8f3bb2dd..b36292b0 100644 --- a/shopelectro/views/service.py +++ b/shopelectro/views/service.py @@ -1,3 +1,4 @@ +import logging from hashlib import md5 from django.conf import settings @@ -10,6 +11,9 @@ from shopelectro.models import Order +logger = logging.getLogger(__name__) + + YANDEX_REQUEST_PARAM = ( 'action', 'orderSumAmount', 'orderSumCurrencyPaycash', 'orderSumBankPaycash', 'shopId', 'invoiceId', 'customerNumber' @@ -88,6 +92,8 @@ def send_mail_to_customer(order): content_type='application/xhtml+xml' ) + logger.info(f'received yandex aviso. Aviso data: {request.POST}') + # maybe we can include django-annoying for such cases # https://github.com/skorokithakis/django-annoying#get_object_or_none-function try: