X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/05f67adb27390c7a9cf214e83550d3bbca88c8f2..aa48ae37a4a0c49642ca4f21c809099c05c79865:/apps/cover/views.py diff --git a/apps/cover/views.py b/apps/cover/views.py index 0c29209c..752a8244 100644 --- a/apps/cover/views.py +++ b/apps/cover/views.py @@ -11,7 +11,7 @@ from django.shortcuts import get_object_or_404, render from django.views.decorators.csrf import csrf_exempt from django.views.decorators.http import require_POST from catalogue.helpers import active_tab -from catalogue.models import Chunk +from catalogue.models import Document from cover.models import Image from cover import forms @@ -25,7 +25,7 @@ def preview(request, book, chunk=None, rev=None): If chunk and rev number are given, use version from given revision. If rev is not given, use publishable version. """ - import Image + from PIL import Image from librarian.cover import WLCover from librarian.dcparser import BookInfo @@ -56,7 +56,7 @@ def preview(request, book, chunk=None, rev=None): @require_POST def preview_from_xml(request): from hashlib import sha1 - import Image + from PIL import Image from os import makedirs from lxml import etree from librarian.cover import WLCover @@ -125,7 +125,7 @@ def add_image(request): if ff.is_valid(): form = forms.ImageAddForm(ff.cleaned_data) else: - form = forms.ImageAddForm(request.POST) + form = forms.ImageAddForm(request.POST, request.FILES) if form.is_valid(): obj = form.save() return HttpResponseRedirect(obj.get_absolute_url())