Author: adrian Date: 2006-04-15 15:12:19 -0500 (Sat, 15 Apr 2006) New Revision: 2701
Modified: django/branches/magic-removal/django/views/generic/create_update.py django/branches/magic-removal/django/views/generic/date_based.py django/branches/magic-removal/django/views/generic/list_detail.py django/branches/magic-removal/docs/generic_views.txt Log: magic-removal: Fixed #1643 -- Updated generic views for template extension change Modified: django/branches/magic-removal/django/views/generic/create_update.py =================================================================== --- django/branches/magic-removal/django/views/generic/create_update.py 2006-04-15 16:46:54 UTC (rev 2700) +++ django/branches/magic-removal/django/views/generic/create_update.py 2006-04-15 20:12:19 UTC (rev 2701) @@ -14,7 +14,7 @@ """ Generic object-creation function. - Templates: ``<app_label>/<model_name>_form`` + Templates: ``<app_label>/<model_name>_form.html`` Context: form the form wrapper for the object @@ -57,7 +57,7 @@ # Create the FormWrapper, template, context, response form = forms.FormWrapper(manipulator, new_data, errors) if not template_name: - template_name = "%s/%s_form" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) c = RequestContext(request, { 'form': form, @@ -77,7 +77,7 @@ """ Generic object-update function. - Templates: ``<app_label>/<model_name>_form`` + Templates: ``<app_label>/<model_name>_form.html`` Context: form the form wrapper for the object @@ -127,7 +127,7 @@ form = forms.FormWrapper(manipulator, new_data, errors) if not template_name: - template_name = "%s/%s_form" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_form.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) c = RequestContext(request, { 'form': form, @@ -153,7 +153,7 @@ fetched using GET; for safty, deletion will only be performed if this view is POSTed. - Templates: ``<app_label>/<model_name>_confirm_delete`` + Templates: ``<app_label>/<model_name>_confirm_delete.html`` Context: object the original object being deleted @@ -182,7 +182,7 @@ return HttpResponseRedirect(post_delete_redirect) else: if not template_name: - template_name = "%s/%s_confirm_delete" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_confirm_delete.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) c = RequestContext(request, { template_object_name: object, Modified: django/branches/magic-removal/django/views/generic/date_based.py =================================================================== --- django/branches/magic-removal/django/views/generic/date_based.py 2006-04-15 16:46:54 UTC (rev 2700) +++ django/branches/magic-removal/django/views/generic/date_based.py 2006-04-15 20:12:19 UTC (rev 2701) @@ -10,7 +10,7 @@ """ Generic top-level archive of date-based objects. - Templates: ``<app_label>/<model_name>_archive`` + Templates: ``<app_label>/<model_name>_archive.html`` Context: date_list List of years @@ -29,7 +29,7 @@ latest = None if not template_name: - template_name = "%s/%s_archive" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_archive.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) c = RequestContext(request, { 'date_list' : date_list, @@ -48,7 +48,7 @@ """ Generic yearly archive view. - Templates: ``<app_label>/<model_name>_archive_year`` + Templates: ``<app_label>/<model_name>_archive_year.html`` Context: date_list List of months in this year with objects @@ -65,7 +65,7 @@ if not date_list and not allow_empty: raise Http404 if not template_name: - template_name = "%s/%s_archive_year" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_archive_year.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) c = RequestContext(request, { 'date_list': date_list, @@ -85,7 +85,7 @@ """ Generic monthly archive view. - Templates: ``<app_label>/<model_name>_archive_month`` + Templates: ``<app_label>/<model_name>_archive_month.html`` Context: month: (date) this month @@ -117,7 +117,7 @@ if not object_list and not allow_empty: raise Http404 if not template_name: - template_name = "%s/%s_archive_month" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_archive_month.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) c = RequestContext(request, { '%s_list' % template_object_name: object_list, @@ -139,7 +139,7 @@ """ Generic daily archive view. - Templates: ``<app_label>/<model_name>_archive_day`` + Templates: ``<app_label>/<model_name>_archive_day.html`` Context: object_list: list of objects published that day @@ -167,7 +167,7 @@ if not allow_empty and not object_list: raise Http404 if not template_name: - template_name = "%s/%s_archive_day" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_archive_day.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) c = RequestContext(request, { '%s_list' % template_object_name: object_list, @@ -202,7 +202,7 @@ """ Generic detail view from year/month/day/slug or year/month/day/id structure. - Templates: ``<app_label>/<model_name>_detail`` + Templates: ``<app_label>/<model_name>_detail.html`` Context: object: the object to be detailed @@ -231,7 +231,7 @@ except ObjectDoesNotExist: raise Http404, "No %s found for" % model._meta.verbose_name if not template_name: - template_name = "%s/%s_detail" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower()) if template_name_field: template_name_list = [getattr(obj, template_name_field), template_name] t = template_loader.select_template(template_name_list) Modified: django/branches/magic-removal/django/views/generic/list_detail.py =================================================================== --- django/branches/magic-removal/django/views/generic/list_detail.py 2006-04-15 16:46:54 UTC (rev 2700) +++ django/branches/magic-removal/django/views/generic/list_detail.py 2006-04-15 20:12:19 UTC (rev 2701) @@ -10,7 +10,7 @@ """ Generic list of objects. - Templates: ``<app_label>/<model_name>_list`` + Templates: ``<app_label>/<model_name>_list.html`` Context: object_list list of objects @@ -71,7 +71,7 @@ else: c[key] = value if not template_name: - template_name = "%s/%s_list" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower()) t = template_loader.get_template(template_name) return HttpResponse(t.render(c)) @@ -82,7 +82,7 @@ """ Generic list of objects. - Templates: ``<app_label>/<model_name>_detail`` + Templates: ``<app_label>/<model_name>_detail.html`` Context: object the object @@ -99,7 +99,7 @@ except ObjectDoesNotExist: raise Http404, "No %s found matching the query" % (model._meta.verbose_name) if not template_name: - template_name = "%s/%s_detail" % (model._meta.app_label, model._meta.object_name.lower()) + template_name = "%s/%s_detail.html" % (model._meta.app_label, model._meta.object_name.lower()) if template_name_field: template_name_list = [getattr(obj, template_name_field), template_name] t = template_loader.select_template(template_name_list) Modified: django/branches/magic-removal/docs/generic_views.txt =================================================================== --- django/branches/magic-removal/docs/generic_views.txt 2006-04-15 16:46:54 UTC (rev 2700) +++ django/branches/magic-removal/docs/generic_views.txt 2006-04-15 20:12:19 UTC (rev 2701) @@ -146,7 +146,7 @@ an empty index page. ``False`` is default. ======================= ================================================= - Uses the template ``<app_label>/<model_name>_archive`` by default, where: + Uses the template ``<app_label>/<model_name>_archive.html`` by default, where: * ``<model_name>`` is your model's name in all lowercase. For a model ``StaffMember``, that'd be ``staffmember``. @@ -168,7 +168,7 @@ Takes an optional ``allow_empty`` parameter, as ``archive_index``. - Uses the template ``<app_label>/<model_name>_archive_year`` by default. + Uses the template ``<app_label>/<model_name>_archive_year.html`` by default. Has the following template context: @@ -193,7 +193,7 @@ ``template_object_name`` parameter, which designates the name of the template variable to use. Default is ``'object'``. - Uses the template ``<app_label>/<model_name>_archive_month`` by default. + Uses the template ``<app_label>/<model_name>_archive_month.html`` by default. Has the following template context: @@ -225,7 +225,7 @@ ``template_object_name`` parameter, which designates the name of the template variable to use. Default is ``'object'``. - Uses the template ``<app_label>/<model_name>_archive_day`` by default. + Uses the template ``<app_label>/<model_name>_archive_day.html`` by default. Has the following template context: @@ -307,7 +307,7 @@ is ``'object'``. ======================== ================================================= - Uses the template ``<app_label>/<module_name_list>`` by default. + Uses the template ``<app_label>/<module_name_list>.html`` by default. Has the following template context: @@ -364,9 +364,9 @@ be interpolated against the object's field attributes. For example, you could use ``post_save_redirect="/polls/%(slug)s/"``. - Uses the template ``<app_label>/<model_name>_form`` by default. This is the - same template as the ``update_object`` view below. Your template can tell - the difference by the presence or absence of ``{{ object }}`` in the + Uses the template ``<app_label>/<model_name>_form.html`` by default. This + is the same template as the ``update_object`` view below. Your template can + tell the difference by the presence or absence of ``{{ object }}`` in the context. Has the following template context: @@ -390,7 +390,7 @@ ``template_object_name`` parameter, which designates the name of the template variable to use. Default is ``'object'``. - Uses the template ``<app_label>/<model_name>_form`` by default. + Uses the template ``<app_label>/<model_name>_form.html`` by default. Has the following template context: --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates -~----------~----~----~----~------~----~------~--~---