Ticket #5961: template_name_comments.diff
File template_name_comments.diff, 6.4 KB (added by , 17 years ago) |
---|
-
django/contrib/comments/views/karma.py
4 4 from django.contrib.comments.models import Comment, KarmaScore 5 5 from django.utils.translation import ugettext as _ 6 6 7 def vote(request, comment_id, vote, extra_context=None, context_processors=None): 7 def vote(request, comment_id, vote, template_name='comments/karma_vote_accepted.html', 8 extra_context=None, context_processors=None): 8 9 """ 9 10 Rate a comment (+1 or -1) 10 11 … … 28 29 KarmaScore.objects.vote(request.user.id, comment_id, rating) 29 30 # Reload comment to ensure we have up to date karma count 30 31 comment = Comment.objects.get(pk=comment_id) 31 return render_to_response( 'comments/karma_vote_accepted.html', {'comment': comment},32 return render_to_response(template_name, {'comment': comment}, 32 33 context_instance=RequestContext(request, extra_context, context_processors)) -
django/contrib/comments/views/userflags.py
6 6 from django.http import HttpResponseRedirect 7 7 from django.conf import settings 8 8 9 def flag(request, comment_id, extra_context=None, context_processors=None): 9 def flag(request, comment_id, template_name='comments/flag_verify.html', 10 extra_context=None, context_processors=None): 10 11 """ 11 12 Flags a comment. Confirmation on GET, action on POST. 12 13 … … 20 21 if request.POST: 21 22 UserFlag.objects.flag(comment, request.user) 22 23 return HttpResponseRedirect('%sdone/' % request.path) 23 return render_to_response( 'comments/flag_verify.html', {'comment': comment},24 return render_to_response(template_name, {'comment': comment}, 24 25 context_instance=RequestContext(request, extra_context, context_processors)) 25 26 flag = login_required(flag) 26 27 27 def flag_done(request, comment_id, extra_context=None, context_processors=None): 28 def flag_done(request, comment_id, template_name='comments/flag_done.html', 29 extra_context=None, context_processors=None): 28 30 if extra_context is None: extra_context = {} 29 31 comment = get_object_or_404(Comment,pk=comment_id, site__id__exact=settings.SITE_ID) 30 return render_to_response( 'comments/flag_done.html', {'comment': comment},32 return render_to_response(template_name, {'comment': comment}, 31 33 context_instance=RequestContext(request, extra_context, context_processors)) 32 34 33 def delete(request, comment_id, extra_context=None, context_processors=None): 35 def delete(request, comment_id, template_name='comments/delete_verify.html', 36 extra_context=None, context_processors=None): 34 37 """ 35 38 Deletes a comment. Confirmation on GET, action on POST. 36 39 … … 51 54 m = ModeratorDeletion(None, request.user.id, comment.id, None) 52 55 m.save() 53 56 return HttpResponseRedirect('%sdone/' % request.path) 54 return render_to_response( 'comments/delete_verify.html', {'comment': comment},57 return render_to_response(template_name, {'comment': comment}, 55 58 context_instance=RequestContext(request, extra_context, context_processors)) 56 59 delete = login_required(delete) 57 60 58 def delete_done(request, comment_id, extra_context=None, context_processors=None): 61 def delete_done(request, comment_id, template_name='comments/delete_done.html', 62 extra_context=None, context_processors=None): 59 63 if extra_context is None: extra_context = {} 60 64 comment = get_object_or_404(Comment,pk=comment_id, site__id__exact=settings.SITE_ID) 61 return render_to_response( 'comments/delete_done.html', {'comment': comment},65 return render_to_response(template_name, {'comment': comment}, 62 66 context_instance=RequestContext(request, extra_context, context_processors)) -
django/contrib/comments/views/comments.py
155 155 c.save() 156 156 return c 157 157 158 def post_comment(request, extra_context=None, context_processors=None):158 def post_comment(request, template_name='comments/preview.html', extra_context=None, context_processors=None): 159 159 """ 160 160 Post a comment 161 161 … … 234 234 return field_list 235 235 comment = errors and '' or manipulator.get_comment(new_data) 236 236 comment_form = CommentFormWrapper(manipulator, new_data, errors, rating_choices) 237 return render_to_response( 'comments/preview.html', {237 return render_to_response(template_name, { 238 238 'comment': comment, 239 239 'comment_form': comment_form, 240 240 'options': options, … … 258 258 else: 259 259 raise Http404, _("The comment form didn't provide either 'preview' or 'post'") 260 260 261 def post_free_comment(request, extra_context=None, context_processors=None):261 def post_free_comment(request, template_name='comments/free_preview.html', extra_context=None, context_processors=None): 262 262 """ 263 263 Post a free comment (not requiring a log in) 264 264 … … 303 303 errors = manipulator.get_validation_errors(new_data) 304 304 if errors or 'preview' in request.POST: 305 305 comment = errors and '' or manipulator.get_comment(new_data) 306 return render_to_response( 'comments/free_preview.html', {306 return render_to_response(template_name, { 307 307 'comment': comment, 308 308 'comment_form': oldforms.FormWrapper(manipulator, new_data, errors), 309 309 'options': options, … … 323 323 else: 324 324 raise Http404, _("The comment form didn't provide either 'preview' or 'post'") 325 325 326 def comment_was_posted(request, extra_context=None, context_processors=None):326 def comment_was_posted(request, template_name='comments/posted.html', extra_context=None, context_processors=None): 327 327 """ 328 328 Display "comment was posted" success page 329 329 … … 341 341 obj = content_type.get_object_for_this_type(pk=object_id) 342 342 except ObjectDoesNotExist: 343 343 pass 344 return render_to_response( 'comments/posted.html', {'object': obj},344 return render_to_response(template_name, {'object': obj}, 345 345 context_instance=RequestContext(request, extra_context, context_processors))