comparison comments/views.py @ 1032:e932f2ecd4a7

Django 1.8 warnings / tech debt cleanup.
author Brian Neal <bgneal@gmail.com>
date Sat, 26 Dec 2015 15:10:55 -0600
parents 68c3343f3318
children 110bbc78a482
comparison
equal deleted inserted replaced
1031:e1c03da72818 1032:e932f2ecd4a7
6 from django.core.exceptions import ObjectDoesNotExist 6 from django.core.exceptions import ObjectDoesNotExist
7 from django.http import HttpResponse 7 from django.http import HttpResponse
8 from django.http import HttpResponseBadRequest 8 from django.http import HttpResponseBadRequest
9 from django.http import HttpResponseForbidden 9 from django.http import HttpResponseForbidden
10 from django.db.models import get_model 10 from django.db.models import get_model
11 from django.shortcuts import render_to_response 11 from django.shortcuts import render
12 from django.template import RequestContext
13 from django.utils.html import escape 12 from django.utils.html import escape
14 from django.views.decorators.http import require_POST 13 from django.views.decorators.http import require_POST
15 14
16 from core.functions import email_admins 15 from core.functions import email_admins
17 from core.html import image_check, ImageCheckError 16 from core.html import image_check, ImageCheckError
97 return HttpResponseForbidden(antispam.BUSTED_MESSAGE) 96 return HttpResponseForbidden(antispam.BUSTED_MESSAGE)
98 97
99 comment.save(html=form.comment_html) 98 comment.save(html=form.comment_html)
100 99
101 # return the rendered comment 100 # return the rendered comment
102 return render_to_response('comments/comment.html', { 101 return render(request, 'comments/comment.html', {
103 'comment': comment, 102 'comment': comment,
104 }, 103 })
105 context_instance = RequestContext(request))
106 104
107 105
108 @require_POST 106 @require_POST
109 def flag_comment(request): 107 def flag_comment(request):
110 """ 108 """
153 try: 151 try:
154 image_check(html) 152 image_check(html)
155 except ImageCheckError as ex: 153 except ImageCheckError as ex:
156 html = PREVIEW_UNAVAILABLE.format(ex) 154 html = PREVIEW_UNAVAILABLE.format(ex)
157 155
158 return render_to_response('comments/markdown_preview.html', { 156 return render(request, 'comments/markdown_preview.html', {
159 'data': html, 157 'data': html,
160 }, 158 })
161 context_instance = RequestContext(request))