Changeset 2453
- Timestamp:
- 02/28/06 21:37:57 (3 years ago)
- Files:
-
- django/trunk/AUTHORS (modified) (1 diff)
- django/trunk/django/views/generic/create_update.py (modified) (4 diffs)
- django/trunk/django/views/generic/date_based.py (modified) (6 diffs)
- django/trunk/django/views/generic/list_detail.py (modified) (5 diffs)
- django/trunk/docs/generic_views.txt (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r2346 r2453 46 46 C8E 47 47 Amit Chakradeo <http://amit.chakradeo.net/> 48 ChaosKCW 48 49 Matt Croydon <http://www.postneo.com/> 49 50 Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/> django/trunk/django/views/generic/create_update.py
r1773 r2453 74 74 slug_field=None, template_name=None, template_loader=loader, 75 75 extra_lookup_kwargs={}, extra_context={}, post_save_redirect=None, 76 login_required=False, follow=None, context_processors=None): 76 login_required=False, follow=None, context_processors=None, 77 template_object_name='object'): 77 78 """ 78 79 Generic object-update function. … … 134 135 c = DjangoContext(request, { 135 136 'form': form, 136 'object': object,137 template_object_name: object, 137 138 }, context_processors) 138 139 for key, value in extra_context.items(): … … 148 149 object_id=None, slug=None, slug_field=None, template_name=None, 149 150 template_loader=loader, extra_lookup_kwargs={}, extra_context={}, 150 login_required=False, context_processors=None ):151 login_required=False, context_processors=None, template_object_name='object'): 151 152 """ 152 153 Generic object-delete function. … … 190 191 t = template_loader.get_template(template_name) 191 192 c = DjangoContext(request, { 192 'object': object,193 template_object_name: object, 193 194 }, context_processors) 194 195 for key, value in extra_context.items(): django/trunk/django/views/generic/date_based.py
r2337 r2453 90 90 month_format='%b', template_name=None, template_loader=loader, 91 91 extra_lookup_kwargs={}, extra_context={}, allow_empty=False, 92 context_processors=None ):92 context_processors=None, template_object_name='object'): 93 93 """ 94 94 Generic monthly archive view. … … 130 130 t = template_loader.get_template(template_name) 131 131 c = DjangoContext(request, { 132 ' object_list': object_list,132 '%s_list' % template_object_name: object_list, 133 133 'month': date, 134 134 'next_month': (last_day < datetime.date.today()) and (last_day + datetime.timedelta(days=1)) or None, … … 145 145 month_format='%b', day_format='%d', template_name=None, 146 146 template_loader=loader, extra_lookup_kwargs={}, extra_context={}, 147 allow_empty=False, context_processors=None ):147 allow_empty=False, context_processors=None, template_object_name='object'): 148 148 """ 149 149 Generic daily archive view. … … 181 181 t = template_loader.get_template(template_name) 182 182 c = DjangoContext(request, { 183 ' object_list': object_list,183 '%s_list' % template_object_name: object_list, 184 184 'day': date, 185 185 'previous_day': date - datetime.timedelta(days=1), … … 209 209 slug_field=None, template_name=None, template_name_field=None, 210 210 template_loader=loader, extra_lookup_kwargs={}, extra_context={}, 211 context_processors=None ):211 context_processors=None, template_object_name='object'): 212 212 """ 213 213 Generic detail view from year/month/day/slug or year/month/day/id structure. … … 250 250 t = template_loader.get_template(template_name) 251 251 c = DjangoContext(request, { 252 'object': object,252 template_object_name: object, 253 253 }, context_processors) 254 254 for key, value in extra_context.items(): django/trunk/django/views/generic/list_detail.py
r2426 r2453 9 9 def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False, 10 10 template_name=None, template_loader=loader, extra_lookup_kwargs={}, 11 extra_context={}, context_processors=None ):11 extra_context={}, context_processors=None, template_object_name='object'): 12 12 """ 13 13 Generic list of objects. … … 50 50 raise Http404 51 51 c = DjangoContext(request, { 52 ' object_list': object_list,52 '%s_list' % template_object_name: object_list, 53 53 'is_paginated': paginator.pages > 1, 54 54 'results_per_page': paginate_by, … … 64 64 object_list = mod.get_list(**lookup_kwargs) 65 65 c = DjangoContext(request, { 66 ' object_list': object_list,66 '%s_list' % template_object_name: object_list, 67 67 'is_paginated': False 68 68 }, context_processors) … … 82 82 slug_field=None, template_name=None, template_name_field=None, 83 83 template_loader=loader, extra_lookup_kwargs={}, extra_context={}, 84 context_processors=None ):84 context_processors=None, template_object_name='object'): 85 85 """ 86 86 Generic list of objects. … … 112 112 t = template_loader.get_template(template_name) 113 113 c = DjangoContext(request, { 114 'object': object,114 template_object_name: object, 115 115 }, context_processors) 116 116 for key, value in extra_context.items(): django/trunk/docs/generic_views.txt
r2337 r2453 193 193 **New in Django development version:** Takes an optional ``allow_empty`` 194 194 parameter, as ``archive_index``. 195 196 **New in Django development version:** Takes an optional 197 ``template_object_name`` parameter, which designates the name of the 198 template variable to use. Default is ``'object'``. 195 199 196 200 Uses the template ``app_label/module_name_archive_month`` by default. … … 208 212 previous month (a datetime.date object) 209 213 ``object_list`` 210 List of objects published in the given month 214 List of objects published in the given month. 215 In the Django development version, you can change this variable 216 name from ``object_list`` by using the ``template_object_name`` 217 parameter. (See above.) For example, if ``template_object_name`` is 218 ``foo``, the variable will be ``foo_list``. 211 219 212 220 ``archive_day`` … … 218 226 decimal number, 1-31). 219 227 228 **New in Django development version:** Takes an optional 229 ``template_object_name`` parameter, which designates the name of the 230 template variable to use. Default is ``'object'``. 231 220 232 Uses the template ``app_label/module_name_archive_day`` by default. 221 233 … … 223 235 224 236 ``object_list`` 225 List of objects published this day 237 List of objects published on the given day. 238 In the Django development version, you can change this variable 239 name from ``object_list`` by using the ``template_object_name`` 240 parameter. (See above.) For example, if ``template_object_name`` is 241 ``foo``, the variable will be ``foo_list``. 226 242 ``day`` 227 243 The given day (a datetime.datetime object) … … 255 271 and ``day_format`` parameters. 256 272 273 **New in Django development version:** Takes an optional 274 ``template_object_name`` parameter, which designates the name of the 275 template variable to use. Default is ``'object'``. 276 257 277 .. _strftime docs: http://www.python.org/doc/current/lib/module-time.html#l2h-1941 258 278 … … 286 306 the view will raise a 404 instead of displaying 287 307 an empty index page. ``False`` is default. 308 ``template_object_name`` **New in Django development version.** Designates 309 the name of the object template variable. Default 310 is ``'object'``. 288 311 ======================= ================================================= 289 312 … … 293 316 294 317 ``object_list`` 295 List of objects 318 List of objects. In the Django development version, you can change 319 this variable name from ``object_list`` by using the 320 ``template_object_name`` parameter. (See above.) For example, if 321 ``template_object_name`` is ``foo``, the variable will be 322 ``foo_list``. 296 323 ``is_paginated`` 297 324 Are the results paginated? Either True or False … … 363 390 ``post_save_redirect`` as ``create_object`` does. 364 391 392 **New in Django development version:** Takes an optional 393 ``template_object_name`` parameter, which designates the name of the 394 template variable to use. Default is ``'object'``. 395 365 396 Uses the template ``app_label/module_name_form`` by default. 366 397 … … 370 401 The form wrapper for the object 371 402 object 372 The original object being edited 403 The original object being edited. 404 In the Django development version, you can change this variable 405 name from ``object`` by using the ``template_object_name`` 406 parameter. (See above.) For example, if ``template_object_name`` is 407 ``foo``, the variable will be ``foo`` instead of ``object``. 373 408 374 409 ``delete_object`` … … 385 420 if POSTed -- it simply deletes the object and redirects. 386 421 422 **New in Django development version:** Takes an optional 423 ``template_object_name`` parameter, which designates the name of the 424 template variable to use. Default is ``'object'``. 425 387 426 Has the following template context: 388 427 389 428 object 390 429 The object about to be deleted 430 In the Django development version, you can change this variable 431 name from ``object`` by using the ``template_object_name`` 432 parameter. (See above.) For example, if ``template_object_name`` is 433 ``foo``, the variable will be ``foo`` instead of ``object``.
