Changeset 3950
- Timestamp:
- 10/30/06 08:30:43 (2 years ago)
- Files:
-
- django/trunk/AUTHORS (modified) (1 diff)
- django/trunk/django/views/generic/simple.py (modified) (1 diff)
- django/trunk/docs/generic_views.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r3941 r3950 161 161 Geert Vanderkelen 162 162 Milton Waddams 163 wam-djangobug@wamber.net 163 164 Dan Watson <http://theidioteque.net/> 164 165 Rachel Willmer <http://www.willmer.com/kb/> django/trunk/django/views/generic/simple.py
r3948 r3950 3 3 from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone 4 4 5 def direct_to_template(request, template, **kwargs):5 def direct_to_template(request, template, extra_context={}, **kwargs): 6 6 """ 7 7 Render a given template with any extra URL parameters in the context as 8 8 ``{{ params }}``. 9 9 """ 10 return render_to_response(template, {'params' : kwargs}, context_instance=RequestContext(request)) 10 dictionary = {'params': kwargs} 11 for key, value in extra_context.items(): 12 if callable(value): 13 dictionary[key] = value() 14 else: 15 dictionary[key] = value 16 return render_to_response(template, dictionary, context_instance=RequestContext(request)) 11 17 12 18 def redirect_to(request, url, **kwargs): django/trunk/docs/generic_views.txt
r3913 r3950 93 93 * ``template``: The full name of a template to use. 94 94 95 **Optional arguments:** 96 97 * ``extra_context``: A dictionary of values to add to the template 98 context. By default, this is an empty dictionary. If a value in the 99 dictionary is callable, the generic view will call it 100 just before rendering the template. 101 95 102 **Example:** 96 103 … … 172 179 173 180 * ``extra_context``: A dictionary of values to add to the template 174 context. By default, this is an empty dictionary. 181 context. By default, this is an empty dictionary. If a value in the 175 182 dictionary is callable, the generic view will call it 176 183 just before rendering the template.
