This commit is contained in:
Iliyan Angelov
2025-12-10 01:36:00 +02:00
parent 2f6dca736a
commit 6a9e823402
84 changed files with 5293 additions and 1836 deletions

View File

@@ -62,6 +62,15 @@ class ContactSubmissionViewSet(viewsets.ModelViewSet):
permission_classes = [IsAuthenticated]
return [permission() for permission in permission_classes]
def get_authenticators(self):
"""
Override authentication for create action to bypass CSRF.
By returning an empty list, DRF won't enforce CSRF for this action.
"""
if hasattr(self, 'action') and self.action == 'create':
return []
return super().get_authenticators()
def create(self, request, *args, **kwargs):
"""
Create a new contact submission.
@@ -259,4 +268,4 @@ class ContactSubmissionViewSet(viewsets.ModelViewSet):
return Response({
'error': 'Failed to send test email',
'status': 'error'
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)