Disable imports in the UI and view
This commit is contained in:
parent
7c7c0e1a93
commit
28567e2d8e
2 changed files with 89 additions and 73 deletions
|
@ -4,6 +4,7 @@ import datetime
|
|||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Avg, ExpressionWrapper, F, fields
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.core.paginator import Paginator
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.shortcuts import redirect
|
||||
|
@ -54,6 +55,10 @@ class Import(View):
|
|||
|
||||
def post(self, request):
|
||||
"""ingest a goodreads csv"""
|
||||
site = models.Site.objects.get()
|
||||
if not site.imports_enabled:
|
||||
raise PermissionDenied()
|
||||
|
||||
form = forms.ImportForm(request.POST, request.FILES)
|
||||
if not form.is_valid():
|
||||
return HttpResponseBadRequest()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue