Changes between Version 12 and Version 13 of ShortcutSyntaxIdeas
- Timestamp:
- Sep 21, 2005, 2:30:49 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ShortcutSyntaxIdeas
v12 v13 96 96 === Idea 1 === 97 97 98 This satisfies the complicated and simplistic decorator, return or yield. 98 This satisfies the complicated and simplistic decorator, return or yield. 99 Also, you can now change the template or context used, by yielding them, e.g. "yield {'template': 'primes/index'}". 99 100 100 101 It goes in django.views.decorators.shortcuts: … … 102 103 {{{ 103 104 #!python 104 def page(template , context=None, **decorator_args):105 def page(template=None, context=None, **decorator_args): 105 106 def _wrapper(fn): 106 107 def _innerWrapper(request, **args): … … 116 117 else: 117 118 context_dict.update(i) 119 template = context_dict.get("template", template) 120 context = context_dict.get("context", context) 118 121 return load_and_render(template, context_dict, context) 119 122