Just for the record: I'm with Ivan here and think that

from django.template.response import TemplateResponse
def my_view(request):
    return TemplateResponse(request, 'foo.html')

is worse than

from django.shortcuts import render
def my_view(request):
    return render(request, 'foo.html')

I think that the cases where user should prefer 'render' returning
HttpResponse over 'render' returning TemplateResponse are rare so the
API by itself should suggest TemplateResponse. TemplateResponse is
more flexible and can provide a performance benefit (the template
rendering can be prevented in some cases).

I don't see much value in adding 'render' shortcut that just use
RequestContext after TemplateResponse is introduced - one can still
use render_to_response if TemplateResponse is undesired and one
shouldn't use such 'render' in other cases.

'render' as alias for TemplateResponse seems fine for me: it is a
shortcut and it adds value by simplifying the API.

On 29 ноя, 19:07, Harro <hvdkl...@gmail.com> wrote:
> I agree with Jacob on the bake/baked thing.. but maybe it's just
> CakePHP coming to haunt me :S
>
> On Nov 29, 1:09 pm, Ivan Sagalaev <man...@softwaremaniacs.org> wrote:
>
>
>
>
>
>
>
> > On 11/29/2010 02:58 PM, Russell Keith-Magee wrote:
>
> > > My counterargument would be this -- if you use TemplateResponse,
> > > there's no need to use a shortcut at all.
>
> > Yes, this is what I understood from your reasoning. I'm concerned more
> > with documentation. Namely, what are we going to suggest for usage in
> > the tutorial. The nice short `render()` shortcut lacks the power of
> > TemplateResponse and TemplateResponse is not *that* nice and short.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@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