This view decorator renders automaticaly the template with the context provided both by the view "return" statement. For example:
@auto_render
def my_view(request):
...
return 'base.html', locals()
You can still return HttpResponse and HttpResponseRedirect objects without any problems. If you use Ajax requests, this decorator is even more useful. Imagine this layout:
def aggregating_view(request):
...
context = locals()
partial1 = partial_view_1(request, only_context=True)
partial2 = partial_view_2(request, only_context=True)
# aggregate template include partial templates
return 'aggregate.htmt', context.update(partial1).update(partial2)
def partial_view_1(request):
...
return 'partial_1.html', locals()
def partial_view_2(request):
...
return 'partial_2.html', locals()
This way you can render you view individualy for specific ajax calls and also get their context for the aggregating view.
- render_to_response
- ajax
- decorator
- rendering