+1

On Oct 15, 10:45 am, Luke Plant <l.plant...@cantab.net> wrote:
> Hi all,
>
> As a consequence of the proposed CSRF changes, we brought up wanting
> to add a shortcut like render_to_response that uses RequestContext, as
> a refinement, but didn't decide on anything.  Ideally, we would have
> something as short as this:
>
>  return render(request, "template_name.html", {'foo':'bar'})
>
> Currently you can do this:
>
>  return render_to_response("template_name.html", {'foo':'bar'},
>              context_instance=RequestContext(request))
>
> This is a bit cumbersome, especially with the need to import
> RequestContext as well as render_to_response.  My proposal: add
> 'request' as a keyword argument to this same function:
>
>  return render_to_response("template_name.html", {'foo':'bar'},
>                             request=request)
>
> It's slightly longer than the 'ideal' could be, but has some quite big
> advantages:
>
>  * you only have one import whether you want to use RequestContext
>    or Context or both.  And it's an import most people will
>    have already in existing code.
>
>  * you don't have to *learn* a new function name or import
>
>  * in the context of the tutorial, it works very well - no
>    new import to add, just a small change which can be explained
>    without even going into how RequestContext works or that
>    it even exists.
>
>  * 'render_to_response' is nice and explicit, and it's very
>    difficult to shorten it without losing that.
>
> Given where we are right now, I think it's the best option so far.
>
> Comments?
>
> Luke
>
> --
> You meet a lot of smart guys with stupid wives, but you almost
> never meet a smart woman with a stupid husband. (Erica Jong)
>
> Luke Plant ||http://lukeplant.me.uk/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to