Changes between Version 3 and Version 4 of ShortcutSyntaxIdeas
- Timestamp:
- Sep 21, 2005, 11:59:49 AM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ShortcutSyntaxIdeas
v3 v4 50 50 prime_index = PrimeIndex('primes/index') 51 51 }}} 52 53 == Idea 3: Function == 54 55 {{{ 56 #!python 57 from django.utils import render 58 59 def index(self, request): 60 return render('index', 'title': 'Page Title', 'primes': [2, 3, 5, 7], 'header': 'The first 4 primes:') 61 }}} 62 52 63 53 64 == Implementations == … … 105 116 return HttpResponse(t.render(c)) 106 117 }}} 118 119 === Idea 3 === 120 121 === Implementation === 122 123 This goes in django.utils: 124 {{{ 125 #!python 126 def render(template, dictionary): 127 t = template_loader.get_template(template) 128 c = Context(dictionary) 129 return HttpResponse(t.render(c)) 130 }}}