Splitbar can now be dragged to an arbitrary position
[redakcja.git] / apps / cover / views.py
index 0c29209..3d30a2a 100644 (file)
@@ -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.
     """
     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
 
     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
 @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
     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:
             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())
             if form.is_valid():
                 obj = form.save()
                 return HttpResponseRedirect(obj.get_absolute_url())