Changeset 2949
- Timestamp:
- 05/21/06 07:44:58 (2 years ago)
- Files:
-
- django/trunk/docs/generic_views.txt (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/generic_views.txt
r2931 r2949 63 63 objects. 64 64 65 Most views also take an optional ``extra_context`` dictionary that you can use 66 to pass any auxiliary information you wish to the view. The values in the 67 ``extra_context`` dictionary can be either functions (or other callables) or 68 other objects. Functions are evaluated just before they are passed to the 69 template. However, note that QuerySets retrieve and cache their data when they 70 are first evaluated, so if you want to pass in a QuerySet via 71 ``extra_context`` that is always fresh you need to wrap it in a function or 72 lambda that returns the QuerySet. 73 65 74 .. _database API docs: http://www.djangoproject.com/documentation/db_api/ 66 75 … … 162 171 163 172 * ``extra_context``: A dictionary of values to add to the template 164 context. By default, this is an empty dictionary. If a value in the 165 dictionary is callable, the generic view will call it 166 just before rendering the template. If it is not callable, it will be 167 evaluated once, at import time. Note that QuerySets are not callable, so 168 if you want to pass in a QuerySet in ``extra_context`` and have it 169 evaluated at render time, you need to wrap it in a function (that 170 returns the QuerySet). 173 context. By default, this is an empty dictionary. 174 dictionary is callable, the generic view will call it 175 just before rendering the template. 171 176 172 177 * ``allow_empty``: A boolean specifying whether to display the page if no … … 233 238 context. By default, this is an empty dictionary. If a value in the 234 239 dictionary is callable, the generic view will call it 235 just before rendering the template. If it is not callable, it will be 236 evaluated once, at import time. Note that QuerySets are not callable, so 237 if you want to pass in a QuerySet in ``extra_context`` and have it 238 evaluated at render time, you need to wrap it in a function (that 239 returns the QuerySet). 240 just before rendering the template. 240 241 241 242 * ``allow_empty``: A boolean specifying whether to display the page if no … … 299 300 context. By default, this is an empty dictionary. If a value in the 300 301 dictionary is callable, the generic view will call it 301 just before rendering the template. If it is not callable, it will be 302 evaluated once, at import time. Note that QuerySets are not callable, so 303 if you want to pass in a QuerySet in ``extra_context`` and have it 304 evaluated at render time, you need to wrap it in a function (that 305 returns the QuerySet). 302 just before rendering the template. 306 303 307 304 * ``allow_empty``: A boolean specifying whether to display the page if no … … 376 373 context. By default, this is an empty dictionary. If a value in the 377 374 dictionary is callable, the generic view will call it 378 just before rendering the template. If it is not callable, it will be 379 evaluated once, at import time. Note that QuerySets are not callable, so 380 if you want to pass in a QuerySet in ``extra_context`` and have it 381 evaluated at render time, you need to wrap it in a function (that 382 returns the QuerySet). 375 just before rendering the template. 383 376 384 377 * ``allow_empty``: A boolean specifying whether to display the page if no … … 456 449 context. By default, this is an empty dictionary. If a value in the 457 450 dictionary is callable, the generic view will call it 458 just before rendering the template. If it is not callable, it will be 459 evaluated once, at import time. Note that QuerySets are not callable, so 460 if you want to pass in a QuerySet in ``extra_context`` and have it 461 evaluated at render time, you need to wrap it in a function (that 462 returns the QuerySet). 451 just before rendering the template. 463 452 464 453 * ``allow_empty``: A boolean specifying whether to display the page if no … … 567 556 context. By default, this is an empty dictionary. If a value in the 568 557 dictionary is callable, the generic view will call it 569 just before rendering the template. If it is not callable, it will be 570 evaluated once, at import time. Note that QuerySets are not callable, so 571 if you want to pass in a QuerySet in ``extra_context`` and have it 572 evaluated at render time, you need to wrap it in a function (that 573 returns the QuerySet). 558 just before rendering the template. 574 559 575 560 * ``context_processors``: A list of template-context processors to apply to … … 628 613 context. By default, this is an empty dictionary. If a value in the 629 614 dictionary is callable, the generic view will call it 630 just before rendering the template. If it is not callable, it will be 631 evaluated once, at import time. Note that QuerySets are not callable, so 632 if you want to pass in a QuerySet in ``extra_context`` and have it 633 evaluated at render time, you need to wrap it in a function (that 634 returns the QuerySet). 615 just before rendering the template. 635 616 636 617 * ``allow_empty``: A boolean specifying whether to display the page if no … … 729 710 context. By default, this is an empty dictionary. If a value in the 730 711 dictionary is callable, the generic view will call it 731 just before rendering the template. If it is not callable, it will be 732 evaluated once, at import time. Note that QuerySets are not callable, so 733 if you want to pass in a QuerySet in ``extra_context`` and have it 734 evaluated at render time, you need to wrap it in a function (that 735 returns the QuerySet). 712 just before rendering the template. 736 713 737 714 * ``context_processors``: A list of template-context processors to apply to … … 800 777 context. By default, this is an empty dictionary. If a value in the 801 778 dictionary is callable, the generic view will call it 802 just before rendering the template. If it is not callable, it will be 803 evaluated once, at import time. Note that QuerySets are not callable, so 804 if you want to pass in a QuerySet in ``extra_context`` and have it 805 evaluated at render time, you need to wrap it in a function (that 806 returns the QuerySet). 779 just before rendering the template. 807 780 808 781 * ``context_processors``: A list of template-context processors to apply to … … 883 856 context. By default, this is an empty dictionary. If a value in the 884 857 dictionary is callable, the generic view will call it 885 just before rendering the template. If it is not callable, it will be 886 evaluated once, at import time. Note that QuerySets are not callable, so 887 if you want to pass in a QuerySet in ``extra_context`` and have it 888 evaluated at render time, you need to wrap it in a function (that 889 returns the QuerySet). 858 just before rendering the template. 890 859 891 860 * ``context_processors``: A list of template-context processors to apply to … … 968 937 context. By default, this is an empty dictionary. If a value in the 969 938 dictionary is callable, the generic view will call it 970 just before rendering the template. If it is not callable, it will be 971 evaluated once, at import time. Note that QuerySets are not callable, so 972 if you want to pass in a QuerySet in ``extra_context`` and have it 973 evaluated at render time, you need to wrap it in a function (that 974 returns the QuerySet). 939 just before rendering the template. 975 940 976 941 * ``context_processors``: A list of template-context processors to apply to
