Changes spacing on import method

This commit is contained in:
Mouse Reeve 2021-12-10 11:43:13 -08:00
parent 10c74d0619
commit d546d9dce9
1 changed files with 25 additions and 26 deletions

View File

@ -37,7 +37,9 @@ class Import(View):
def post(self, request): def post(self, request):
"""ingest a goodreads csv""" """ingest a goodreads csv"""
form = forms.ImportForm(request.POST, request.FILES) form = forms.ImportForm(request.POST, request.FILES)
if form.is_valid(): if not form.is_valid():
return HttpResponseBadRequest()
include_reviews = request.POST.get("include_reviews") == "on" include_reviews = request.POST.get("include_reviews") == "on"
privacy = request.POST.get("privacy") privacy = request.POST.get("privacy")
source = request.POST.get("source") source = request.POST.get("source")
@ -54,9 +56,7 @@ class Import(View):
try: try:
job = importer.create_job( job = importer.create_job(
request.user, request.user,
TextIOWrapper( TextIOWrapper(request.FILES["csv_file"], encoding=importer.encoding),
request.FILES["csv_file"], encoding=importer.encoding
),
include_reviews, include_reviews,
privacy, privacy,
) )
@ -66,4 +66,3 @@ class Import(View):
importer.start_import(job) importer.start_import(job)
return redirect(f"/import/{job.id}") return redirect(f"/import/{job.id}")
return HttpResponseBadRequest()