from cover.models import Image
from cover import forms
-
PREVIEW_SIZE = (216, 300)
except:
return HttpResponseRedirect(os.path.join(settings.STATIC_URL, "img/sample_cover.png"))
cover = DefaultEbookCover(info)
- response = HttpResponse(mimetype=cover.mime_type())
+ response = HttpResponse(content_type=cover.mime_type())
image = cover.image().resize(PREVIEW_SIZE, Image.ANTIALIAS)
image.save(response, cover.format)
return response
editable = False
return render(request, "cover/image_detail.html", {
- "object": image,
+ "object": Image.objects.get(id=image.id),
"form": form,
"editable": editable,
})
@active_tab('cover')
def image_list(request):
- objects = Image.objects.all()
- enable_add = request.user.has_perm('cover.add_image')
return render(request, "cover/image_list.html", {
'object_list': Image.objects.all(),
'can_add': request.user.has_perm('cover.add_image'),