Changes between Version 6 and Version 7 of ShortcutSyntaxIdeas


Ignore:
Timestamp:
09/21/2005 12:10:47 PM (10 years ago)
Author:
adrian
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ShortcutSyntaxIdeas

    v6 v7  
    7171{{{
    7272#!python
    73 from django.core.template_loader import load_and_render
     73from django.core.extensions import load_and_render
    7474
    7575def index(self, request):
     
    137137=== Implementation ===
    138138
    139 This goes in django.core.template_loader:
     139This goes in django.core.extensions:
    140140{{{
    141141#!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))
     142def 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)
    146147}}}
Back to Top