1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
def render_response(func):
def inner(request, *args, **kwargs):
result = func(request, *args, **kwargs)
if isinstance(result, HttpResponse):
return result
template, dictionary = result
return render_to_response(template, dictionary,
context_instance=RequestContext(request))
return inner
|
More like this
- Better render_to_response by SmileyChris 6 years, 1 month ago
- Detect iPhone & Switch Template via render_to_response by bryanhelmig 2 years, 12 months ago
- simplified render_to_response with RequestContext by jasongreen 3 years, 4 months ago
- render_to by asolovyov 4 years, 11 months ago
- Caching XHTML render_to_response by smoonen 4 years, 10 months ago
Comments