prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Правь шаблон писем
  В шаблоне письма, который приходит если оплачивать онлайн, нет строки комментариями. Как в обычном шаблоне. Добавь.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `shopelectro/views/ecommerce.py`
  Content:
  ```
  1 from django.conf import settings
  2 from django.core import serializers
  3 from django.http import HttpResponse, JsonResponse
  4 from django.shortcuts import get_object_or_404, render
  5 from django.views.decorators.http import require_POST
  6 
  7 from ecommerce import mailer, views as ec_views
  8 from pages.models import CustomPage
  9 
  10 from shopelectro.cart import SECart
  11 from shopelectro.forms import OrderForm
  12 from shopelectro.models import Product, Order
  13 
  14 
  15 # ECOMMERCE VIEWS
  16 class OrderPage(ec_views.OrderPage):
  17     order_form = OrderForm
  18     cart = SECart
  19 
  20     def get_context_data(self, request, **kwargs):
  21         return {
  22             **super(OrderPage, self).get_context_data(request, **kwargs),
  23             'page': CustomPage.objects.get(slug='order'),
  24         }
  25 
  26 
  27 class AddToCart(ec_views.AddToCart):
  28     cart = SECart
  29     product_model = Product
  30     order_form = OrderForm
  31 
  32 
  33 class RemoveFromCart(ec_views.RemoveFromCart):
  34     cart = SECart
  35     product_model = Product
  36     order_form = OrderForm
  37 
  38 
  39 class ChangeCount(ec_views.ChangeCount):
  40     cart = SECart
  41     product_model = Product
  42     order_form = OrderForm
  43 
  44 
  45 class FlushCart(ec_views.FlushCart):
  46     product_model = Product
  47     order_form = OrderForm
  48 
  49 
  50 class OrderSuccess(ec_views.OrderSuccess):
  51     order = Order.objects.all().prefetch_related('positions')
  52 
  53     def get_context_data(self, **kwargs):
  54         context = super().get_context_data(**kwargs)
  55         positions_json = serializers.serialize(
  56             'json',
  57             context['order'].positions.all(),
  58             fields=['name', 'quantity', 'price'],
  59         )
  60 
  61         return {
  62             **context,
  63             'positions_json': positions_json,
  64         }
  65 
  66 
  67 @require_POST
  68 def one_click_buy(request):
  69     """
  70     Handle one-click-buy.
  71 
  72     Accept XHR, save Order to DB, send mail about it
  73     and return 200 OK.
  74     """
  75     SECart(request.session).clear()
  76 
  77     cart = SECart(request.session)
  78     product = get_object_or_404(Product, id=request.POST['product'])
  79     cart.add(product, int(request.POST['quantity']))
  80     order = Order(phone=request.POST['phone'])
  81     order.set_positions(cart)
  82     ec_views.save_order_to_session(request.session, order)
  83     mailer.send_order(
  84         subject=settings.EMAIL_SUBJECTS['one_click'],
  85         order=order,
  86         to_customer=False,
  87     )
  88     return HttpResponse('ok')
  89 
  90 
  91 @require_POST
  92 def order_call(request):
  93     """Send email about ordered call."""
  94     phone, time, url = ec_views.get_keys_from_post(
  95         request, 'phone', 'time', 'url')
  96 
  97     mailer.send_backcall(
  98         subject=settings.EMAIL_SUBJECTS['call'],
  99         phone=phone,
  100         time=time,
  101         url=url,
  102     )
  103 
  104     return HttpResponse('ok')
  105 
  106 
  107 class YandexOrder(OrderPage):
  108 
  109     def post(self, request):
  110         cart = self.cart(request.session)
  111         form = self.order_form(request.POST.dict())
  112 
  113         if not form.is_valid():
  114             return render(request, self.template, {'cart': cart, 'form': form})
  115 
  116         order = form.save()
  117         order.set_positions(cart)
  118         ec_views.save_order_to_session(request.session, order)
  119 
  120         # Took form fields from Yandex docs https://goo.gl/afKfsz
  121         response_data = {
  122             'yandex_kassa_link': settings.YANDEX_KASSA_LINK,  # Required
  123             'shopId': settings.SHOP['id'],  # Required
  124             'scid': settings.SHOP['scid'],  # Required
  125             'shopSuccessURL': settings.SHOP['success_url'],
  126             'shopFailURL': settings.SHOP['fail_url'],
  127             'customerNumber': order.id,  # Required
  128             'sum': order.total_price,  # Required
  129             'orderNumber': order.fake_order_number,
  130             'cps_phone': order.phone,
  131             'cps_email': order.email,
  132             'paymentType': request.POST.get('payment_type'),
  133         }
  134 
  135         return JsonResponse(response_data)
  136
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/shopelectro/views/ecommerce.py b/shopelectro/views/ecommerce.py
  --- a/shopelectro/views/ecommerce.py
  +++ b/shopelectro/views/ecommerce.py
  @@ -1,3 +1,5 @@
  +import json
  +
   from django.conf import settings
   from django.core import serializers
   from django.http import HttpResponse, JsonResponse
  @@ -18,9 +20,13 @@
       cart = SECart
   
       def get_context_data(self, request, **kwargs):
  +        data = super().get_context_data(request, **kwargs)
           return {
  -            **super(OrderPage, self).get_context_data(request, **kwargs),
  +            **data,
               'page': CustomPage.objects.get(slug='order'),
  +            'raw_order_fields': json.dumps({
  +                field.html_name: f'#{field.id_for_label}' for field in data['form']
  +            }),
           }
   
   
  @@ -108,8 +114,7 @@
   
       def post(self, request):
           cart = self.cart(request.session)
  -        form = self.order_form(request.POST.dict())
  -
  +        form = self.order_form(request.POST)
           if not form.is_valid():
               return render(request, self.template, {'cart': cart, 'form': form})
  
verification_info: {"golden_diff": "diff --git a/shopelectro/views/ecommerce.py b/shopelectro/views/ecommerce.py\n--- a/shopelectro/views/ecommerce.py\n+++ b/shopelectro/views/ecommerce.py\n@@ -1,3 +1,5 @@\n+import json\n+\n from django.conf import settings\n from django.core import serializers\n from django.http import HttpResponse, JsonResponse\n@@ -18,9 +20,13 @@\n     cart = SECart\n \n     def get_context_data(self, request, **kwargs):\n+        data = super().get_context_data(request, **kwargs)\n         return {\n-            **super(OrderPage, self).get_context_data(request, **kwargs),\n+            **data,\n             'page': CustomPage.objects.get(slug='order'),\n+            'raw_order_fields': json.dumps({\n+                field.html_name: f'#{field.id_for_label}' for field in data['form']\n+            }),\n         }\n \n \n@@ -108,8 +114,7 @@\n \n     def post(self, request):\n         cart = self.cart(request.session)\n-        form = self.order_form(request.POST.dict())\n-\n+        form = self.order_form(request.POST)\n         if not form.is_valid():\n             return render(request, self.template, {'cart': cart, 'form': form})\n", "issue": "\u041f\u0440\u0430\u0432\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0438\u0441\u0435\u043c\n\u0412 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043f\u0438\u0441\u044c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0435\u0441\u043b\u0438 \u043e\u043f\u043b\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043e\u043d\u043b\u0430\u0439\u043d, \u043d\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438. \u041a\u0430\u043a \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0435. \u0414\u043e\u0431\u0430\u0432\u044c.\n", "before_files": [{"content": "from django.conf import settings\nfrom django.core import serializers\nfrom django.http import HttpResponse, JsonResponse\nfrom django.shortcuts import get_object_or_404, render\nfrom django.views.decorators.http import require_POST\n\nfrom ecommerce import mailer, views as ec_views\nfrom pages.models import CustomPage\n\nfrom shopelectro.cart import SECart\nfrom shopelectro.forms import OrderForm\nfrom shopelectro.models import Product, Order\n\n\n# ECOMMERCE VIEWS\nclass OrderPage(ec_views.OrderPage):\n    order_form = OrderForm\n    cart = SECart\n\n    def get_context_data(self, request, **kwargs):\n        return {\n            **super(OrderPage, self).get_context_data(request, **kwargs),\n            'page': CustomPage.objects.get(slug='order'),\n        }\n\n\nclass AddToCart(ec_views.AddToCart):\n    cart = SECart\n    product_model = Product\n    order_form = OrderForm\n\n\nclass RemoveFromCart(ec_views.RemoveFromCart):\n    cart = SECart\n    product_model = Product\n    order_form = OrderForm\n\n\nclass ChangeCount(ec_views.ChangeCount):\n    cart = SECart\n    product_model = Product\n    order_form = OrderForm\n\n\nclass FlushCart(ec_views.FlushCart):\n    product_model = Product\n    order_form = OrderForm\n\n\nclass OrderSuccess(ec_views.OrderSuccess):\n    order = Order.objects.all().prefetch_related('positions')\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        positions_json = serializers.serialize(\n            'json',\n            context['order'].positions.all(),\n            fields=['name', 'quantity', 'price'],\n        )\n\n        return {\n            **context,\n            'positions_json': positions_json,\n        }\n\n\n@require_POST\ndef one_click_buy(request):\n    \"\"\"\n    Handle one-click-buy.\n\n    Accept XHR, save Order to DB, send mail about it\n    and return 200 OK.\n    \"\"\"\n    SECart(request.session).clear()\n\n    cart = SECart(request.session)\n    product = get_object_or_404(Product, id=request.POST['product'])\n    cart.add(product, int(request.POST['quantity']))\n    order = Order(phone=request.POST['phone'])\n    order.set_positions(cart)\n    ec_views.save_order_to_session(request.session, order)\n    mailer.send_order(\n        subject=settings.EMAIL_SUBJECTS['one_click'],\n        order=order,\n        to_customer=False,\n    )\n    return HttpResponse('ok')\n\n\n@require_POST\ndef order_call(request):\n    \"\"\"Send email about ordered call.\"\"\"\n    phone, time, url = ec_views.get_keys_from_post(\n        request, 'phone', 'time', 'url')\n\n    mailer.send_backcall(\n        subject=settings.EMAIL_SUBJECTS['call'],\n        phone=phone,\n        time=time,\n        url=url,\n    )\n\n    return HttpResponse('ok')\n\n\nclass YandexOrder(OrderPage):\n\n    def post(self, request):\n        cart = self.cart(request.session)\n        form = self.order_form(request.POST.dict())\n\n        if not form.is_valid():\n            return render(request, self.template, {'cart': cart, 'form': form})\n\n        order = form.save()\n        order.set_positions(cart)\n        ec_views.save_order_to_session(request.session, order)\n\n        # Took form fields from Yandex docs https://goo.gl/afKfsz\n        response_data = {\n            'yandex_kassa_link': settings.YANDEX_KASSA_LINK,  # Required\n            'shopId': settings.SHOP['id'],  # Required\n            'scid': settings.SHOP['scid'],  # Required\n            'shopSuccessURL': settings.SHOP['success_url'],\n            'shopFailURL': settings.SHOP['fail_url'],\n            'customerNumber': order.id,  # Required\n            'sum': order.total_price,  # Required\n            'orderNumber': order.fake_order_number,\n            'cps_phone': order.phone,\n            'cps_email': order.email,\n            'paymentType': request.POST.get('payment_type'),\n        }\n\n        return JsonResponse(response_data)\n", "path": "shopelectro/views/ecommerce.py"}], "after_files": [{"content": "import json\n\nfrom django.conf import settings\nfrom django.core import serializers\nfrom django.http import HttpResponse, JsonResponse\nfrom django.shortcuts import get_object_or_404, render\nfrom django.views.decorators.http import require_POST\n\nfrom ecommerce import mailer, views as ec_views\nfrom pages.models import CustomPage\n\nfrom shopelectro.cart import SECart\nfrom shopelectro.forms import OrderForm\nfrom shopelectro.models import Product, Order\n\n\n# ECOMMERCE VIEWS\nclass OrderPage(ec_views.OrderPage):\n    order_form = OrderForm\n    cart = SECart\n\n    def get_context_data(self, request, **kwargs):\n        data = super().get_context_data(request, **kwargs)\n        return {\n            **data,\n            'page': CustomPage.objects.get(slug='order'),\n            'raw_order_fields': json.dumps({\n                field.html_name: f'#{field.id_for_label}' for field in data['form']\n            }),\n        }\n\n\nclass AddToCart(ec_views.AddToCart):\n    cart = SECart\n    product_model = Product\n    order_form = OrderForm\n\n\nclass RemoveFromCart(ec_views.RemoveFromCart):\n    cart = SECart\n    product_model = Product\n    order_form = OrderForm\n\n\nclass ChangeCount(ec_views.ChangeCount):\n    cart = SECart\n    product_model = Product\n    order_form = OrderForm\n\n\nclass FlushCart(ec_views.FlushCart):\n    product_model = Product\n    order_form = OrderForm\n\n\nclass OrderSuccess(ec_views.OrderSuccess):\n    order = Order.objects.all().prefetch_related('positions')\n\n    def get_context_data(self, **kwargs):\n        context = super().get_context_data(**kwargs)\n        positions_json = serializers.serialize(\n            'json',\n            context['order'].positions.all(),\n            fields=['name', 'quantity', 'price'],\n        )\n\n        return {\n            **context,\n            'positions_json': positions_json,\n        }\n\n\n@require_POST\ndef one_click_buy(request):\n    \"\"\"\n    Handle one-click-buy.\n\n    Accept XHR, save Order to DB, send mail about it\n    and return 200 OK.\n    \"\"\"\n    SECart(request.session).clear()\n\n    cart = SECart(request.session)\n    product = get_object_or_404(Product, id=request.POST['product'])\n    cart.add(product, int(request.POST['quantity']))\n    order = Order(phone=request.POST['phone'])\n    order.set_positions(cart)\n    ec_views.save_order_to_session(request.session, order)\n    mailer.send_order(\n        subject=settings.EMAIL_SUBJECTS['one_click'],\n        order=order,\n        to_customer=False,\n    )\n    return HttpResponse('ok')\n\n\n@require_POST\ndef order_call(request):\n    \"\"\"Send email about ordered call.\"\"\"\n    phone, time, url = ec_views.get_keys_from_post(\n        request, 'phone', 'time', 'url')\n\n    mailer.send_backcall(\n        subject=settings.EMAIL_SUBJECTS['call'],\n        phone=phone,\n        time=time,\n        url=url,\n    )\n\n    return HttpResponse('ok')\n\n\nclass YandexOrder(OrderPage):\n\n    def post(self, request):\n        cart = self.cart(request.session)\n        form = self.order_form(request.POST)\n        if not form.is_valid():\n            return render(request, self.template, {'cart': cart, 'form': form})\n\n        order = form.save()\n        order.set_positions(cart)\n        ec_views.save_order_to_session(request.session, order)\n\n        # Took form fields from Yandex docs https://goo.gl/afKfsz\n        response_data = {\n            'yandex_kassa_link': settings.YANDEX_KASSA_LINK,  # Required\n            'shopId': settings.SHOP['id'],  # Required\n            'scid': settings.SHOP['scid'],  # Required\n            'shopSuccessURL': settings.SHOP['success_url'],\n            'shopFailURL': settings.SHOP['fail_url'],\n            'customerNumber': order.id,  # Required\n            'sum': order.total_price,  # Required\n            'orderNumber': order.fake_order_number,\n            'cps_phone': order.phone,\n            'cps_email': order.email,\n            'paymentType': request.POST.get('payment_type'),\n        }\n\n        return JsonResponse(response_data)\n", "path": "shopelectro/views/ecommerce.py"}]}