Skip to content

Commit

Permalink
fix: Totally disable submissions when parameter is set
Browse files Browse the repository at this point in the history
  • Loading branch information
pnu-s committed Nov 21, 2023
1 parent 6e62742 commit 628f067
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion exodus/analysis_query/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'],
Expand Down

0 comments on commit 628f067

Please sign in to comment.