sforkowany z mtyton/comfy
updated mail context
rodzic
2d464431ba
commit
dcae7a433f
|
@ -3,6 +3,7 @@ from django.conf import settings
|
|||
|
||||
from mailings.models import OutgoingEmail
|
||||
from store.models import Product
|
||||
from store.admin import ProductAdmin
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -16,11 +17,12 @@ def send_produt_request_email(variant_pk: int):
|
|||
logger.exception(f"Product with pk={variant_pk} does not exist")
|
||||
|
||||
try:
|
||||
admin_url = ProductAdmin().url_helper.get_action_url("edit", variant.pk)
|
||||
send = OutgoingEmail.objects.send(
|
||||
template_name="product_request",
|
||||
subject="Złożono zapytanie ofertowe",
|
||||
recipient=variant.template.author.email,
|
||||
context={"product": variant},
|
||||
context={"product": variant, "admin_url": admin_url},
|
||||
sender=settings.DEFAULT_FROM_EMAIL
|
||||
)
|
||||
except Exception as e:
|
||||
|
|
Ładowanie…
Reference in New Issue