#11549: contrib.comments should allow users to specify their own template on error --------------------------------------+------------------------------------- Reporter: teebes | Owner: nobody Status: new | Milestone: Component: django.contrib.comments | Version: SVN Keywords: comments, error, preview | Stage: Unreviewed Has_patch: 1 | --------------------------------------+------------------------------------- Currently in contrib.comments, if there is an error on the form the user is taken to a page that is generated by the preview template. This means that you can't have the user stay on the exact same page they were on if they submitted it with a mistake.
This patch introduces a new parameter to post_comment in contrib.comments.views.comments, that is None by default but that can contain an overwrite template location and extra context variable. To get this to work, a user would just need to overwrite the comments/post url in urls.py and make it point to a custom wrapper around post_comment. For example: urls.py: {{{ (r'^comments/post/$', 'thebes.quanda_comments.views.custom_post_comment'), }}} quanda_comments/views.py: {{{ from django.contrib.comments.views.comments import post_comment from django.http import HttpResponseRedirect from thebes.quanda.models import Answer def custom_post_comment(request): answers = Answer.objects.all() error_page = { 'template': 'quanda/index.html', 'data': { 'answers': answers }, } response = post_comment(request, error_page=error_page) return response }}} The impact is minimal, with only one file changed and no reverse compatibility issues. I've inclued both code path and documentation patch. -- Ticket URL: <http://code.djangoproject.com/ticket/11549> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---