| 41 | |
| 42 | {{{ |
| 43 | #!python |
| 44 | from django.views.decorators.shortcuts import page |
| 45 | |
| 46 | # also: |
| 47 | |
| 48 | @page('primes/index', title='Page Title') # @page(template_name, **default_context) |
| 49 | def prime_index(request): |
| 50 | primes = [2,3,5,7] |
| 51 | header = "The first 4 primes" |
| 52 | yield locals() |
| 53 | }}} |
| 54 | |
| 55 | ''I was merely trying to show that you can yield sequentially, and it would add to a single dict. You could just as easily yield a single dictionary. But I've found that sometimes it is nice to be able to yield items at different parts of the function. Also, one can "yield locals()", which can be fun. I've added it above'' - Brantley |