CARVIEW |
Select Language
HTTP/2 200
server: nginx
content-type: text/html;charset=utf-8
cache-control: must-revalidate
expires: Fri, 01 Jan 1999 00:00:00 GMT
set-cookie: trac_form_token=c13028f7f25563033a6d0614; HttpOnly; Path=/; Secure
set-cookie: trac_session=234843ad9a1d78b6c485a893; expires=Tue, 21 Oct 2025 05:40:02 GMT; HttpOnly; Path=/; Secure
strict-transport-security: max-age=31536000; includeSubDomains; preload
permissions-policy: interest-cohort=()
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
accept-ranges: bytes
via: 1.1 varnish, 1.1 varnish
date: Wed, 23 Jul 2025 05:40:02 GMT
x-served-by: cache-fra-etou8220124-FRA, cache-bom-vanm7210028-BOM
x-cache: MISS, MISS
x-cache-hits: 0, 0
x-timer: S1753249202.004584,VS0,VE364
vary: Accept-Encoding
CookBookShortcutsPageDecoratorSimple – Django
Back to Top
Django
The web framework for perfectionists with deadlines.
Issues
Code:
from django.shortcuts import render_to_response from django.template import RequestContext def render_to(tmpl): def renderer(func): def wrapper(request, *args, **kw): output = func(request, *args, **kw) if not isinstance(output, dict): return output return render_to_response(tmpl, output, context_instance=RequestContext(request)) return wrapper return renderer
Usage:
@render_to('cool/template.html') def view(request): if something: return HttpResponseRedirect('/') else: return {'people': people, 'things': things}
Last modified
18 years ago
Last modified on Feb 19, 2007, 8:43:07 AM
Note:
See TracWiki
for help on using the wiki.
Download in other formats:
Django Links
Learn More
Get Involved
Follow Us
- Hosting by In-kind donors
- Design by Threespot &
© 2005-2025 Django SoftwareFoundation unless otherwise noted. Django is a registered trademark of the Django Software Foundation.