Changeset 2701
- Timestamp:
- 04/15/06 15:12:19 (3 years ago)
- Files:
-
- django/branches/magic-removal/django/views/generic/create_update.py (modified) (6 diffs)
- django/branches/magic-removal/django/views/generic/date_based.py (modified) (10 diffs)
- django/branches/magic-removal/django/views/generic/list_detail.py (modified) (4 diffs)
- django/branches/magic-removal/docs/generic_views.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/magic-removal/django/views/generic/create_update.py
r2595 r2701 15 15 Generic object-creation function. 16 16 17 Templates: ``<app_label>/<model_name>_form ``17 Templates: ``<app_label>/<model_name>_form.html`` 18 18 Context: 19 19 form … … 58 58 form = forms.FormWrapper(manipulator, new_data, errors) 59 59 if not template_name: 60 template_name = "%s/%s_form " % (model._meta.app_label, model._meta.object_name.lower())60 template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower()) 61 61 t = template_loader.get_template(template_name) 62 62 c = RequestContext(request, { … … 78 78 Generic object-update function. 79 79 80 Templates: ``<app_label>/<model_name>_form ``80 Templates: ``<app_label>/<model_name>_form.html`` 81 81 Context: 82 82 form … … 128 128 form = forms.FormWrapper(manipulator, new_data, errors) 129 129 if not template_name: 130 template_name = "%s/%s_form " % (model._meta.app_label, model._meta.object_name.lower())130 template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower()) 131 131 t = template_loader.get_template(template_name) 132 132 c = RequestContext(request, { … … 154 154 view is POSTed. 155 155 156 Templates: ``<app_label>/<model_name>_confirm_delete ``156 Templates: ``<app_label>/<model_name>_confirm_delete.html`` 157 157 Context: 158 158 object … … 183 183 else: 184 184 if not template_name: 185 template_name = "%s/%s_confirm_delete " % (model._meta.app_label, model._meta.object_name.lower())185 template_name = "%s/%s_confirm_delete.html" % (model._meta.app_label, model._meta.object_name.lower()) 186 186 t = template_loader.get_template(template_name) 187 187 c = RequestContext(request, { django/branches/magic-removal/django/views/generic/date_based.py
r2455 r2701 11 11 Generic top-level archive of date-based objects. 12 12 13 Templates: ``<app_label>/<model_name>_archive ``13 Templates: ``<app_label>/<model_name>_archive.html`` 14 14 Context: 15 15 date_list … … 30 30 31 31 if not template_name: 32 template_name = "%s/%s_archive " % (model._meta.app_label, model._meta.object_name.lower())32 template_name = "%s/%s_archive.html" % (model._meta.app_label, model._meta.object_name.lower()) 33 33 t = template_loader.get_template(template_name) 34 34 c = RequestContext(request, { … … 49 49 Generic yearly archive view. 50 50 51 Templates: ``<app_label>/<model_name>_archive_year ``51 Templates: ``<app_label>/<model_name>_archive_year.html`` 52 52 Context: 53 53 date_list … … 66 66 raise Http404 67 67 if not template_name: 68 template_name = "%s/%s_archive_year " % (model._meta.app_label, model._meta.object_name.lower())68 template_name = "%s/%s_archive_year.html" % (model._meta.app_label, model._meta.object_name.lower()) 69 69 t = template_loader.get_template(template_name) 70 70 c = RequestContext(request, { … … 86 86 Generic monthly archive view. 87 87 88 Templates: ``<app_label>/<model_name>_archive_month ``88 Templates: ``<app_label>/<model_name>_archive_month.html`` 89 89 Context: 90 90 month: … … 118 118 raise Http404 119 119 if not template_name: 120 template_name = "%s/%s_archive_month " % (model._meta.app_label, model._meta.object_name.lower())120 template_name = "%s/%s_archive_month.html" % (model._meta.app_label, model._meta.object_name.lower()) 121 121 t = template_loader.get_template(template_name) 122 122 c = RequestContext(request, { … … 140 140 Generic daily archive view. 141 141 142 Templates: ``<app_label>/<model_name>_archive_day ``142 Templates: ``<app_label>/<model_name>_archive_day.html`` 143 143 Context: 144 144 object_list: … … 168 168 raise Http404 169 169 if not template_name: 170 template_name = "%s/%s_archive_day " % (model._meta.app_label, model._meta.object_name.lower())170 template_name = "%s/%s_archive_day.html" % (model._meta.app_label, model._meta.object_name.lower()) 171 171 t = template_loader.get_template(template_name) 172 172 c = RequestContext(request, { … … 203 203 Generic detail view from year/month/day/slug or year/month/day/id structure. 204 204 205 Templates: ``<app_label>/<model_name>_detail ``205 Templates: ``<app_label>/<model_name>_detail.html`` 206 206 Context: 207 207 object: … … 232 232 raise Http404, "No %s found for" % model._meta.verbose_name 233 233 if not template_name: 234 template_name = "%s/%s_detail " % (model._meta.app_label, model._meta.object_name.lower())234 template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower()) 235 235 if template_name_field: 236 236 template_name_list = [getattr(obj, template_name_field), template_name] django/branches/magic-removal/django/views/generic/list_detail.py
r2455 r2701 11 11 Generic list of objects. 12 12 13 Templates: ``<app_label>/<model_name>_list ``13 Templates: ``<app_label>/<model_name>_list.html`` 14 14 Context: 15 15 object_list … … 72 72 c[key] = value 73 73 if not template_name: 74 template_name = "%s/%s_list " % (model._meta.app_label, model._meta.object_name.lower())74 template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower()) 75 75 t = template_loader.get_template(template_name) 76 76 return HttpResponse(t.render(c)) … … 83 83 Generic list of objects. 84 84 85 Templates: ``<app_label>/<model_name>_detail ``85 Templates: ``<app_label>/<model_name>_detail.html`` 86 86 Context: 87 87 object … … 100 100 raise Http404, "No %s found matching the query" % (model._meta.verbose_name) 101 101 if not template_name: 102 template_name = "%s/%s_detail " % (model._meta.app_label, model._meta.object_name.lower())102 template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower()) 103 103 if template_name_field: 104 104 template_name_list = [getattr(obj, template_name_field), template_name] django/branches/magic-removal/docs/generic_views.txt
r2549 r2701 147 147 ======================= ================================================= 148 148 149 Uses the template ``<app_label>/<model_name>_archive `` by default, where:149 Uses the template ``<app_label>/<model_name>_archive.html`` by default, where: 150 150 151 151 * ``<model_name>`` is your model's name in all lowercase. For a model … … 169 169 Takes an optional ``allow_empty`` parameter, as ``archive_index``. 170 170 171 Uses the template ``<app_label>/<model_name>_archive_year `` by default.171 Uses the template ``<app_label>/<model_name>_archive_year.html`` by default. 172 172 173 173 Has the following template context: … … 194 194 template variable to use. Default is ``'object'``. 195 195 196 Uses the template ``<app_label>/<model_name>_archive_month `` by default.196 Uses the template ``<app_label>/<model_name>_archive_month.html`` by default. 197 197 198 198 Has the following template context: … … 226 226 template variable to use. Default is ``'object'``. 227 227 228 Uses the template ``<app_label>/<model_name>_archive_day `` by default.228 Uses the template ``<app_label>/<model_name>_archive_day.html`` by default. 229 229 230 230 Has the following template context: … … 308 308 ======================== ================================================= 309 309 310 Uses the template ``<app_label>/<module_name_list> `` by default.310 Uses the template ``<app_label>/<module_name_list>.html`` by default. 311 311 312 312 Has the following template context: … … 365 365 could use ``post_save_redirect="/polls/%(slug)s/"``. 366 366 367 Uses the template ``<app_label>/<model_name>_form `` by default. This is the368 same template as the ``update_object`` view below. Your template can tell369 t he difference by the presence or absence of ``{{ object }}`` in the367 Uses the template ``<app_label>/<model_name>_form.html`` by default. This 368 is the same template as the ``update_object`` view below. Your template can 369 tell the difference by the presence or absence of ``{{ object }}`` in the 370 370 context. 371 371 … … 391 391 template variable to use. Default is ``'object'``. 392 392 393 Uses the template ``<app_label>/<model_name>_form `` by default.393 Uses the template ``<app_label>/<model_name>_form.html`` by default. 394 394 395 395 Has the following template context:
