pull/2/head
mtyton 2023-06-08 20:28:54 +02:00
rodzic a66b6c85bb
commit 04886a3e06
2 zmienionych plików z 15 dodań i 28 usunięć

Wyświetl plik

@ -208,20 +208,21 @@ class OrderManager(models.Manager):
order = self.create(customer=customer_data)
OrderProduct.objects.create_from_cart(cart, order)
# create proper documents
agreement_template = DocumentTemplate.objects.filter(
doc_type=DocumentTypeChoices.AGREEMENT
).order_by("-created_at").first()
receipt_template = DocumentTemplate.objects.filter(
doc_type=DocumentTypeChoices.RECEIPT
).order_by("-created_at").first()
agreement = OrderDocument.objects.create(
order=order,
template=agreement_template
)
receipt = OrderDocument.objects.create(
order=order,
template=receipt_template
)
# NOTE - this is temporary
# agreement_template = DocumentTemplate.objects.filter(
# doc_type=DocumentTypeChoices.AGREEMENT
# ).order_by("-created_at").first()
# receipt_template = DocumentTemplate.objects.filter(
# doc_type=DocumentTypeChoices.RECEIPT
# ).order_by("-created_at").first()
# agreement = OrderDocument.objects.create(
# order=order,
# template=agreement_template
# )
# receipt = OrderDocument.objects.create(
# order=order,
# template=receipt_template
# )
#send_mail(agreement)
#send_mail(receipt)
return order

Wyświetl plik

@ -141,17 +141,3 @@ class OrderConfirmView(View):
cart.clear()
# TODO - messages
return HttpResponseRedirect(reverse("cart"))
class SendMailView(View):
def get(self, request):
from django.core import mail
from django.http import HttpResponse
from django.conf import settings
r = mail.send_mail(
subject=f"Test",
message="Dokumenty dla Twojego zamówienia",
from_email=settings.DEFAULT_FROM_EMAIL,
recipient_list=["mateusz.tyton99@gmail.com"]
)
return HttpResponse(f"Mail sent: {r}")