Code

Changes between Version 3 and Version 4 of ShortcutSyntaxIdeas


Ignore:
Timestamp:
09/21/05 09:59:49 (9 years ago)
Author:
brantley (deadwisdom@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ShortcutSyntaxIdeas

    v3 v4  
    5050prime_index = PrimeIndex('primes/index') 
    5151}}} 
     52 
     53== Idea 3: Function == 
     54 
     55{{{ 
     56#!python 
     57from django.utils import render 
     58 
     59def index(self, request): 
     60     return render('index', 'title': 'Page Title', 'primes': [2, 3, 5, 7], 'header': 'The first 4 primes:') 
     61}}} 
     62 
    5263 
    5364== Implementations == 
     
    105116        return HttpResponse(t.render(c)) 
    106117}}} 
     118 
     119=== Idea 3 === 
     120 
     121=== Implementation === 
     122 
     123This goes in django.utils: 
     124{{{ 
     125#!python 
     126def render(template, dictionary): 
     127    t = template_loader.get_template(template) 
     128    c = Context(dictionary) 
     129    return HttpResponse(t.render(c)) 
     130}}}