Refactor email system and add contact form backend
Refactored email sending to use a single HTML template with a base layout, removed plain text email templates, and updated all related backend logic. Introduced a new ContactMe model, serializer, Celery task, and API endpoints for handling contact form submissions, including email notifications. Renamed ShopConfiguration to SiteConfiguration throughout the backend for consistency. Updated frontend to remove unused components, add a new Services section, and adjust navigation and contact form integration.
This commit is contained in:
@@ -10,7 +10,7 @@ from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from weasyprint import HTML
|
||||
import os
|
||||
|
||||
from configuration.models import ShopConfiguration
|
||||
from configuration.models import SiteConfiguration
|
||||
|
||||
from thirdparty.zasilkovna.models import ZasilkovnaPacket
|
||||
from thirdparty.stripe.models import StripeModel
|
||||
@@ -240,7 +240,7 @@ class Carrier(models.Model):
|
||||
|
||||
def get_price(self):
|
||||
if self.shipping_method == self.SHIPPING.ZASILKOVNA:
|
||||
return ShopConfiguration.get_solo().zasilkovna_shipping_price
|
||||
return SiteConfiguration.get_solo().zasilkovna_shipping_price
|
||||
else:
|
||||
return Decimal('0.0')
|
||||
|
||||
@@ -285,10 +285,10 @@ class Carrier(models.Model):
|
||||
|
||||
class Payment(models.Model):
|
||||
class PAYMENT(models.TextChoices):
|
||||
SHOP = "shop", "cz#Platba v obchodě"
|
||||
Site = "Site", "cz#Platba v obchodě"
|
||||
STRIPE = "stripe", "cz#Bankovní převod"
|
||||
CASH_ON_DELIVERY = "cash_on_delivery", "cz#Dobírka"
|
||||
payment_method = models.CharField(max_length=30, choices=PAYMENT.choices, default=PAYMENT.SHOP)
|
||||
payment_method = models.CharField(max_length=30, choices=PAYMENT.choices, default=PAYMENT.Site)
|
||||
|
||||
#FIXME: potvrdit že logika platby funguje správně
|
||||
#veškera logika a interakce bude na stripu (třeba aktualizovaní objednávky na zaplacenou apod.)
|
||||
@@ -360,7 +360,7 @@ class OrderItem(models.Model):
|
||||
def get_total_price(self, discounts: list[DiscountCode] = None):
|
||||
"""Vrátí celkovou cenu položky po aplikaci relevantních kupónů.
|
||||
|
||||
Logika dle ShopConfiguration:
|
||||
Logika dle SiteConfiguration:
|
||||
- multiplying_coupons=True: procentuální slevy se násobí (sekvenčně)
|
||||
P * (1 - p1) -> výsledné * (1 - p2) ...
|
||||
jinak se použije pouze nejlepší (nejvyšší procento).
|
||||
@@ -375,7 +375,7 @@ class OrderItem(models.Model):
|
||||
return base_price
|
||||
|
||||
|
||||
config = ShopConfiguration.get_solo()
|
||||
config = SiteConfiguration.get_solo()
|
||||
|
||||
#seznám slev
|
||||
applicable_percent_discounts: list[int] = []
|
||||
|
||||
Reference in New Issue
Block a user