Move attempt to resolve books to view action.

This commit is contained in:
Adam Kelly
2020-04-12 13:54:10 +01:00
parent f2f0c979f1
commit 5148820fa3
2 changed files with 6 additions and 8 deletions

View File

@ -2,6 +2,7 @@
from io import BytesIO, TextIOWrapper
import re
from PIL import Image
from requests import HTTPError
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
@ -424,6 +425,10 @@ def import_data(request):
for item in GoodreadsCsv(TextIOWrapper(
request.FILES['csv_file'],
encoding=request.encoding)):
try:
item.resolve()
except HttpError:
pass
if item.book:
results.append(item)
if item.rating or item.review: