From 459f6563d07f6652ccc6681abf42d477434e1358 Mon Sep 17 00:00:00 2001 From: Jochen Klar Date: Thu, 23 Jan 2025 10:25:28 +0100 Subject: [PATCH] Fix contact action --- rdmo/projects/viewsets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rdmo/projects/viewsets.py b/rdmo/projects/viewsets.py index 0527882b2..d9b6215e1 100644 --- a/rdmo/projects/viewsets.py +++ b/rdmo/projects/viewsets.py @@ -332,6 +332,7 @@ def visibility(self, request, pk=None): permission_classes=(HasModelPermission | HasProjectPermission, )) def contact(self, request, pk): if settings.PROJECT_CONTACT: + project = self.get_object() if request.method == 'POST': subject = request.data.get('subject') message = request.data.get('message') @@ -345,11 +346,10 @@ def contact(self, request, pk): 'message': [_('This field may not be blank.')] if not message else [] }) else: - project = self.get_object() project.catalog.prefetch_elements() return Response(get_contact_message(request, project)) else: - return 404 + raise Http404 @action(detail=False, url_path='upload-accept', permission_classes=(IsAuthenticated, )) def upload_accept(self, request):