X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1a2ba641f553db5582303a52329c345d0d437f35..92407309a3a6c4cd125086728910effddd92ab20:/apps/wiki_img/views.py diff --git a/apps/wiki_img/views.py b/apps/wiki_img/views.py index 2b987dc1..2b8dd67e 100644 --- a/apps/wiki_img/views.py +++ b/apps/wiki_img/views.py @@ -3,13 +3,12 @@ import functools import logging logger = logging.getLogger("fnp.wiki_img") -from django.views.generic.simple import direct_to_template from django.core.urlresolvers import reverse from wiki.helpers import (JSONResponse, JSONFormInvalid, JSONServerError, ajax_require_permission) -from django import http -from django.shortcuts import get_object_or_404 +from django.http import Http404, HttpResponse, HttpResponseForbidden +from django.shortcuts import get_object_or_404, render from django.views.decorators.http import require_GET, require_POST from django.conf import settings from django.utils.formats import localize @@ -30,7 +29,7 @@ from django.views.decorators.cache import never_cache def editor(request, slug, template_name='wiki_img/document_details.html'): doc = get_object_or_404(Image, slug=slug) - return direct_to_template(request, template_name, extra_context={ + return render(request, template_name, { 'document': doc, 'forms': { "text_save": ImageSaveForm(user=request.user, prefix="textsave"), @@ -50,7 +49,7 @@ def editor_readonly(request, slug, template_name='wiki_img/document_details_read except (KeyError): raise Http404 - return direct_to_template(request, template_name, extra_context={ + return render(request, template_name, { 'document': doc, 'revision': revision, 'readonly': True, @@ -189,7 +188,7 @@ def diff(request, object_id): docA = "" docB = doc.at_revision(revB).materialize() - return http.HttpResponse(nice_diff.html_diff_table(docA.splitlines(), + return HttpResponse(nice_diff.html_diff_table(docA.splitlines(), docB.splitlines(), context=3))