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.
25 lines
769 B
Python
25 lines
769 B
Python
from rest_framework import viewsets, mixins
|
|
from rest_framework.permissions import IsAdminUser, AllowAny
|
|
from .models import SiteConfiguration
|
|
from .serializers import (
|
|
SiteConfigurationAdminSerializer,
|
|
SiteConfigurationPublicSerializer,
|
|
)
|
|
|
|
|
|
class _SingletonQuerysetMixin:
|
|
def get_queryset(self):
|
|
return SiteConfiguration.objects.filter(pk=1)
|
|
|
|
def get_object(self):
|
|
return SiteConfiguration.get_solo()
|
|
|
|
|
|
class SiteConfigurationAdminViewSet(_SingletonQuerysetMixin, viewsets.ModelViewSet):
|
|
permission_classes = [IsAdminUser]
|
|
serializer_class = SiteConfigurationAdminSerializer
|
|
|
|
|
|
class SiteConfigurationPublicViewSet(_SingletonQuerysetMixin, viewsets.ReadOnlyModelViewSet):
|
|
permission_classes = [AllowAny]
|
|
serializer_class = SiteConfigurationPublicSerializer |