1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from django.shortcuts import render_to_response
from django.template import RequestContext
def render_with(template):
def render_with_decorator(view_func):
def wrapper(*args, **kwargs):
request = args[0]
context = view_func(*args, **kwargs)
return render_to_response(
template,
context,
context_instance=RequestContext(request),
)
return wrapper
return render_with_decorator
|
More like this
- render_to by asolovyov 4 years, 11 months ago
- simplified render_to_response with RequestContext by jasongreen 3 years, 4 months ago
- Auto rendering decorator with options by Batiste 5 years, 4 months ago
- render_to_response wrapper by Magus 6 years, 3 months ago
- Render (with RequestContext) by alcides 4 years, 10 months ago
Comments
here, take a look http://www.djangosnippets.org/snippets/821/
#