From b8600fe84c5f782a1fb3a38922fb1c05d7b14c7b Mon Sep 17 00:00:00 2001 From: Max Yakovenko Date: Thu, 23 Aug 2018 09:54:53 +0300 Subject: [PATCH] fix cart app --- cart/forms.py | 4 ++-- cart/tasks.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cart/forms.py b/cart/forms.py index 19d7eec..5ec7c23 100644 --- a/cart/forms.py +++ b/cart/forms.py @@ -162,7 +162,7 @@ class CartCheckoutForm(RequestNotifiable, forms.ModelForm): 'order_id': self.instance.id, 'site_url': request.build_absolute_uri(), } - return send_user_order_notification.delay(context=context) + return send_user_order_notification(context=context) def send_order_request(self, request): context = { @@ -175,7 +175,7 @@ class CartCheckoutForm(RequestNotifiable, forms.ModelForm): 'send_at_date': self.instance.create_at, } - return send_admin_order_notification.delay(context=context) + return send_admin_order_notification(context=context) class Meta: model = Order diff --git a/cart/tasks.py b/cart/tasks.py index 73e6dec..d519653 100644 --- a/cart/tasks.py +++ b/cart/tasks.py @@ -9,13 +9,12 @@ from django.core.mail import EmailMessage, EmailMultiAlternatives from cart.models import Order - @celery.task() def send_user_order_notification(context): """ Sending Email of order creating """ - order = Order.active.get(pk=context['order_id']) + order = Order.objects.get(pk=context['order_id']) verb_price = pytils.numeral.in_words(round(order.total_price)) verb_cur = pytils.numeral.choose_plural(round(order.total_price), ("рубль", "рубля", "рублей")) subject = 'Заказ № {}'.format(order.id) @@ -26,7 +25,7 @@ def send_user_order_notification(context): # html = render_to_string('orders:AdminOrderPDF', args=[order_id]) - html = render_to_string('orders/pdf.html', {**settings.PAY_REQUISITES, 'order': order, + html = render_to_string('cart/order_invoice.html', {**settings.PAY_REQUISITES, 'order': order, 'verb_cur': verb_cur, 'verb_price': verb_price}) rendered_html = html.encode(encoding="UTF-8") out = BytesIO()