From 4fc92f1e3c41baf2ab963c84f82d879ef7f93ef7 Mon Sep 17 00:00:00 2001 From: Pnu <6069449+pnu-s@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:44:07 +0100 Subject: [PATCH] fix: Totally disable submissions when parameter is set (#595) --- exodus/analysis_query/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exodus/analysis_query/views.py b/exodus/analysis_query/views.py index cf1bd0f5..fcf6e510 100644 --- a/exodus/analysis_query/views.py +++ b/exodus/analysis_query/views.py @@ -6,7 +6,7 @@ from django.conf import settings from django.http import HttpResponseRedirect -from django.http import JsonResponse +from django.http import JsonResponse, HttpResponse from django.http.response import Http404 from django.shortcuts import render from django.urls import reverse @@ -54,6 +54,10 @@ def get_context_data(self, **kwargs): return context def form_valid(self, form): + if settings.DISABLE_SUBMISSIONS and not self.request.user.is_superuser: + # Returns an empty page with 503 status code + return HttpResponse(status=503) + randhex = str(random_word(60)) req = AnalysisRequest( handle=form.cleaned_data['handle'],