On Thu, Mar 14, 2013 at 3:20 PM, alex.v.ko...@gmail.com < alex.v.ko...@gmail.com> wrote:
> Hi, > > In django 1.4 and prior the following shortcut has been found and used > extensively: > > ----------- > from django.views.generic.simple import direct_to_template > def home(request): > return direct_to_template(request, 'form.html', {'somevar':1}) > ----------- > > This is much shorter then to write full: > ----------- > from django.shortcuts import render_to_response, get_object_or_404 > from django.template import RequestContext > return render_to_response('form.html', RequestContext(request, > {'somevar':1})) > ----------- > > Are there good shortcut for the same in Django 1.5? > Yes, there is -- Django 1.4 introduced the "render" shortcut: from django.shortcuts import render def my_view(request): return render(request, 'form.html', {'samovar': 1}) Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.