Changes between Version 6 and Version 7 of ShortcutSyntaxIdeas
- Timestamp:
- Sep 21, 2005, 12:10:47 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ShortcutSyntaxIdeas
v6 v7 71 71 {{{ 72 72 #!python 73 from django.core. template_loaderimport load_and_render73 from django.core.extensions import load_and_render 74 74 75 75 def index(self, request): … … 137 137 === Implementation === 138 138 139 This goes in django.core. template_loader:139 This goes in django.core.extensions: 140 140 {{{ 141 141 #!python 142 def load_and_render(template, dictionary): 143 t = template_loader.get_template(template) 144 c = Context(dictionary) 145 return HttpResponse(t.render(c)) 142 def load_and_render(template_name, dictionary, context=None): 143 context = context or Context 144 t = template_loader.get_template(template_name) 145 c = context(dictionary) 146 return t.render(c) 146 147 }}}