diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 39db8d27d1..cfa174287b 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -102,9 +102,6 @@ INSTALLED_APPS = () # List of locations of the template source files, in search order. TEMPLATE_DIRS = () -# Extension on all templates. -TEMPLATE_FILE_EXTENSION = '.html' - # List of callables that know how to import templates from various sources. # See the comments in django/core/template/loader.py for interface # documentation. diff --git a/django/contrib/admin/templates/admin/404.html b/django/contrib/admin/templates/admin/404.html index d791f565ba..9bf4293e76 100644 --- a/django/contrib/admin/templates/admin/404.html +++ b/django/contrib/admin/templates/admin/404.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block title %}{% trans 'Page not found' %}{% endblock %} diff --git a/django/contrib/admin/templates/admin/500.html b/django/contrib/admin/templates/admin/500.html index 9d3e3de32c..b30e43170d 100644 --- a/django/contrib/admin/templates/admin/500.html +++ b/django/contrib/admin/templates/admin/500.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/admin/base_site.html b/django/contrib/admin/templates/admin/base_site.html index b4d285b779..b867bd29bd 100644 --- a/django/contrib/admin/templates/admin/base_site.html +++ b/django/contrib/admin/templates/admin/base_site.html @@ -1,4 +1,4 @@ -{% extends "admin/base" %} +{% extends "admin/base.html" %} {% load i18n %} {% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %} diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index 47cbff821f..2ccb1d7fb4 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n admin_modify adminmedia %} {% block extrahead %}{{ block.super }} diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html index 11ea944b61..5b54bfb8cc 100644 --- a/django/contrib/admin/templates/admin/change_list.html +++ b/django/contrib/admin/templates/admin/change_list.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load adminmedia admin_list i18n %} {% block stylesheet %}{% admin_media_prefix %}css/changelists.css{% endblock %} {% block bodyclass %}change-list{% endblock %} diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html index 29a435a12b..f907c18a16 100644 --- a/django/contrib/admin/templates/admin/delete_confirmation.html +++ b/django/contrib/admin/templates/admin/delete_confirmation.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block userlinks %}{% trans 'Documentation' %} / {% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} {% block breadcrumbs %} diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html index 4106dcaa17..246086861b 100644 --- a/django/contrib/admin/templates/admin/index.html +++ b/django/contrib/admin/templates/admin/index.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/dashboard.css{% endblock %} @@ -14,7 +14,7 @@ {% if app_list %} {% for app in app_list %}
- +
{% for model in app.models %} diff --git a/django/contrib/admin/templates/admin/login.html b/django/contrib/admin/templates/admin/login.html index 27ef380775..5f338f703e 100644 --- a/django/contrib/admin/templates/admin/login.html +++ b/django/contrib/admin/templates/admin/login.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block stylesheet %}{% load adminmedia %}{% admin_media_prefix %}css/login.css{% endblock %} diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html index 828fc17931..0dbe7af743 100644 --- a/django/contrib/admin/templates/admin/object_history.html +++ b/django/contrib/admin/templates/admin/object_history.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block userlinks %}{% trans 'Documentation' %} / {% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} {% block breadcrumbs %} diff --git a/django/contrib/admin/templates/admin/template_validator.html b/django/contrib/admin/templates/admin/template_validator.html index f9ac09a77d..422e90261f 100644 --- a/django/contrib/admin/templates/admin/template_validator.html +++ b/django/contrib/admin/templates/admin/template_validator.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% block content %} diff --git a/django/contrib/admin/templates/admin_doc/bookmarklets.html b/django/contrib/admin/templates/admin_doc/bookmarklets.html index 708473750a..fa5942926f 100644 --- a/django/contrib/admin/templates/admin_doc/bookmarklets.html +++ b/django/contrib/admin/templates/admin_doc/bookmarklets.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% block breadcrumbs %}{% load i18n %}{% endblock %} {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/index.html b/django/contrib/admin/templates/admin_doc/index.html index 6665f4bb42..331774d2b3 100644 --- a/django/contrib/admin/templates/admin_doc/index.html +++ b/django/contrib/admin/templates/admin_doc/index.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/missing_docutils.html b/django/contrib/admin/templates/admin_doc/missing_docutils.html index a7cf7e95d7..d0b571f957 100644 --- a/django/contrib/admin/templates/admin_doc/missing_docutils.html +++ b/django/contrib/admin/templates/admin_doc/missing_docutils.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/model_detail.html b/django/contrib/admin/templates/admin_doc/model_detail.html index 2aad437ac4..953bb4bf54 100644 --- a/django/contrib/admin/templates/admin_doc/model_detail.html +++ b/django/contrib/admin/templates/admin_doc/model_detail.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} {% block extrahead %} diff --git a/django/contrib/admin/templates/admin_doc/model_index.html b/django/contrib/admin/templates/admin_doc/model_index.html index 2641225e87..c681da75c9 100644 --- a/django/contrib/admin/templates/admin_doc/model_index.html +++ b/django/contrib/admin/templates/admin_doc/model_index.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block coltype %}colSM{% endblock %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/template_detail.html b/django/contrib/admin/templates/admin_doc/template_detail.html index d2a2831098..df67f1856b 100644 --- a/django/contrib/admin/templates/admin_doc/template_detail.html +++ b/django/contrib/admin/templates/admin_doc/template_detail.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/template_filter_index.html b/django/contrib/admin/templates/admin_doc/template_filter_index.html index 30ddee9d64..72344c16cb 100644 --- a/django/contrib/admin/templates/admin_doc/template_filter_index.html +++ b/django/contrib/admin/templates/admin_doc/template_filter_index.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block coltype %}colSM{% endblock %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/template_tag_index.html b/django/contrib/admin/templates/admin_doc/template_tag_index.html index 9051ae5dde..287475ab09 100644 --- a/django/contrib/admin/templates/admin_doc/template_tag_index.html +++ b/django/contrib/admin/templates/admin_doc/template_tag_index.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block coltype %}colSM{% endblock %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/view_detail.html b/django/contrib/admin/templates/admin_doc/view_detail.html index a7e920e0d6..ba90399358 100644 --- a/django/contrib/admin/templates/admin_doc/view_detail.html +++ b/django/contrib/admin/templates/admin_doc/view_detail.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} diff --git a/django/contrib/admin/templates/admin_doc/view_index.html b/django/contrib/admin/templates/admin_doc/view_index.html index a054ceb66b..caab8a2e71 100644 --- a/django/contrib/admin/templates/admin_doc/view_index.html +++ b/django/contrib/admin/templates/admin_doc/view_index.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block coltype %}colSM{% endblock %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/registration/logged_out.html b/django/contrib/admin/templates/registration/logged_out.html index 756f82aadc..d339ef0a49 100644 --- a/django/contrib/admin/templates/registration/logged_out.html +++ b/django/contrib/admin/templates/registration/logged_out.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/registration/password_change_done.html b/django/contrib/admin/templates/registration/password_change_done.html index f163e55a68..85e1bf216c 100644 --- a/django/contrib/admin/templates/registration/password_change_done.html +++ b/django/contrib/admin/templates/registration/password_change_done.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index 096e66ce13..036d56212c 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block userlinks %}{% trans 'Documentation' %} / {% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/registration/password_reset_done.html b/django/contrib/admin/templates/registration/password_reset_done.html index dff293c931..f97b5688c2 100644 --- a/django/contrib/admin/templates/registration/password_reset_done.html +++ b/django/contrib/admin/templates/registration/password_reset_done.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html index 1b6a2c9a17..423821ba60 100644 --- a/django/contrib/admin/templates/registration/password_reset_form.html +++ b/django/contrib/admin/templates/registration/password_reset_form.html @@ -1,4 +1,4 @@ -{% extends "admin/base_site" %} +{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %}{% endblock %} diff --git a/django/contrib/admin/templates/widget/many_to_many.html b/django/contrib/admin/templates/widget/many_to_many.html index 151fe04f30..a93aa65f73 100644 --- a/django/contrib/admin/templates/widget/many_to_many.html +++ b/django/contrib/admin/templates/widget/many_to_many.html @@ -1 +1 @@ -{% include "widget/foreign" %} +{% include "widget/foreign.html" %} diff --git a/django/contrib/admin/templates/widget/one_to_one.html b/django/contrib/admin/templates/widget/one_to_one.html index 151fe04f30..a93aa65f73 100644 --- a/django/contrib/admin/templates/widget/one_to_one.html +++ b/django/contrib/admin/templates/widget/one_to_one.html @@ -1 +1 @@ -{% include "widget/foreign" %} +{% include "widget/foreign.html" %} diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index a034df37bc..d2e57486e0 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -65,7 +65,7 @@ def pagination(cl): 'ALL_VAR': ALL_VAR, '1': 1, } -pagination = register.inclusion_tag('admin/pagination')(pagination) +pagination = register.inclusion_tag('admin/pagination.html')(pagination) def result_headers(cl): lookup_opts = cl.lookup_opts @@ -185,7 +185,7 @@ def result_list(cl): return {'cl': cl, 'result_headers': list(result_headers(cl)), 'results': list(results(cl))} -result_list = register.inclusion_tag("admin/change_list_results")(result_list) +result_list = register.inclusion_tag("admin/change_list_results.html")(result_list) def date_hierarchy(cl): if cl.lookup_opts.admin.date_hierarchy: @@ -245,7 +245,7 @@ def date_hierarchy(cl): 'title': year.year } for year in years] } -date_hierarchy = register.inclusion_tag('admin/date_hierarchy')(date_hierarchy) +date_hierarchy = register.inclusion_tag('admin/date_hierarchy.html')(date_hierarchy) def search_form(cl): return { @@ -253,12 +253,12 @@ def search_form(cl): 'show_result_count': cl.result_count != cl.full_result_count and not cl.opts.one_to_one_field, 'search_var': SEARCH_VAR } -search_form = register.inclusion_tag('admin/search_form')(search_form) +search_form = register.inclusion_tag('admin/search_form.html')(search_form) def filter(cl, spec): return {'title': spec.title(), 'choices' : list(spec.choices(cl))} -filter = register.inclusion_tag('admin/filter')(filter) +filter = register.inclusion_tag('admin/filter.html')(filter) def filters(cl): return {'cl': cl} -filters = register.inclusion_tag('admin/filters')(filters) +filters = register.inclusion_tag('admin/filters.html')(filters) diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py index 8daaa4e464..60be8a91a7 100644 --- a/django/contrib/admin/templatetags/admin_modify.py +++ b/django/contrib/admin/templatetags/admin_modify.py @@ -35,7 +35,7 @@ def submit_row(context): 'show_save_and_continue': not is_popup and context['has_change_permission'], 'show_save': True } -submit_row = register.inclusion_tag('admin/submit_line', takes_context=True)(submit_row) +submit_row = register.inclusion_tag('admin/submit_line.html', takes_context=True)(submit_row) def field_label(bound_field): class_names = [] @@ -64,7 +64,7 @@ class FieldWidgetNode(template.Node): if not cls.nodelists.has_key(klass): try: field_class_name = klass.__name__ - template_name = "widget/%s" % class_name_to_underscored(field_class_name) + template_name = "widget/%s.html" % class_name_to_underscored(field_class_name) nodelist = loader.get_template(template_name).nodelist except template.TemplateDoesNotExist: super_klass = bool(klass.__bases__) and klass.__bases__[0] or None @@ -72,7 +72,7 @@ class FieldWidgetNode(template.Node): nodelist = cls.get_nodelist(super_klass) else: if not cls.default: - cls.default = loader.get_template("widget/default").nodelist + cls.default = loader.get_template("widget/default.html").nodelist nodelist = cls.default cls.nodelists[klass] = nodelist @@ -126,7 +126,7 @@ class TabularBoundRelatedObject(BoundRelatedObject): self.show_url = original and hasattr(self.relation.opts, 'get_absolute_url') def template_name(self): - return "admin/edit_inline_tabular" + return "admin/edit_inline_tabular.html" class StackedBoundRelatedObject(BoundRelatedObject): def __init__(self, related_object, field_mapping, original): @@ -138,7 +138,7 @@ class StackedBoundRelatedObject(BoundRelatedObject): self.show_url = original and hasattr(self.relation.opts, 'get_absolute_url') def template_name(self): - return "admin/edit_inline_stacked" + return "admin/edit_inline_stacked.html" class EditInlineNode(template.Node): def __init__(self, rel_var): @@ -229,4 +229,4 @@ def admin_field_line(context, argument_val): 'bound_fields': bound_fields, 'class_names': " ".join(class_names), } -admin_field_line = register.inclusion_tag('admin/field_line', takes_context=True)(admin_field_line) +admin_field_line = register.inclusion_tag('admin/field_line.html', takes_context=True)(admin_field_line) diff --git a/django/contrib/admin/views/decorators.py b/django/contrib/admin/views/decorators.py index 0c766eef6a..d984077dfb 100644 --- a/django/contrib/admin/views/decorators.py +++ b/django/contrib/admin/views/decorators.py @@ -19,7 +19,7 @@ def _display_login_form(request, error_message=''): post_data = _encode_post_data(request.POST) else: post_data = _encode_post_data({}) - return render_to_response('admin/login', { + return render_to_response('admin/login.html', { 'title': _('Log in'), 'app_path': request.path, 'post_data': post_data, diff --git a/django/contrib/admin/views/doc.py b/django/contrib/admin/views/doc.py index fa7088d5d9..f3675b6adf 100644 --- a/django/contrib/admin/views/doc.py +++ b/django/contrib/admin/views/doc.py @@ -17,13 +17,13 @@ MODEL_METHODS_EXCLUDE = ('_', 'add_', 'delete', 'save', 'set_') def doc_index(request): if not utils.docutils_is_available: return missing_docutils_page(request) - return render_to_response('admin_doc/index', context_instance=RequestContext(request)) + return render_to_response('admin_doc/index.html', context_instance=RequestContext(request)) doc_index = staff_member_required(doc_index) def bookmarklets(request): # Hack! This couples this view to the URL it lives at. admin_root = request.path[:-len('doc/bookmarklets/')] - return render_to_response('admin_doc/bookmarklets', { + return render_to_response('admin_doc/bookmarklets.html', { 'admin_url': "%s://%s%s" % (os.environ.get('HTTPS') == 'on' and 'https' or 'http', get_host(request), admin_root), }, context_instance=RequestContext(request)) bookmarklets = staff_member_required(bookmarklets) @@ -56,7 +56,7 @@ def template_tag_index(request): 'library': tag_library, }) - return render_to_response('admin_doc/template_tag_index', {'tags': tags}, context_instance=RequestContext(request)) + return render_to_response('admin_doc/template_tag_index.html', {'tags': tags}, context_instance=RequestContext(request)) template_tag_index = staff_member_required(template_tag_index) def template_filter_index(request): @@ -86,7 +86,7 @@ def template_filter_index(request): 'meta': metadata, 'library': tag_library, }) - return render_to_response('admin_doc/template_filter_index', {'filters': filters}, context_instance=RequestContext(request)) + return render_to_response('admin_doc/template_filter_index.html', {'filters': filters}, context_instance=RequestContext(request)) template_filter_index = staff_member_required(template_filter_index) def view_index(request): @@ -97,8 +97,8 @@ def view_index(request): settings_modules = [__import__(m, '', '', ['']) for m in settings.ADMIN_FOR] else: settings_modules = [settings] - - views = [] + + views = [] for settings_mod in settings_modules: urlconf = __import__(settings_mod.ROOT_URLCONF, '', '', ['']) view_functions = extract_views_from_urlpatterns(urlconf.urlpatterns) @@ -110,7 +110,7 @@ def view_index(request): 'site': Site.objects.get(pk=settings_mod.SITE_ID), 'url': simplify_regex(regex), }) - return render_to_response('admin_doc/view_index', {'views': views}, context_instance=RequestContext(request)) + return render_to_response('admin_doc/view_index.html', {'views': views}, context_instance=RequestContext(request)) view_index = staff_member_required(view_index) def view_detail(request, view): @@ -129,7 +129,7 @@ def view_detail(request, view): body = utils.parse_rst(body, 'view', 'view:' + view) for key in metadata: metadata[key] = utils.parse_rst(metadata[key], 'model', 'view:' + view) - return render_to_response('admin_doc/view_detail', { + return render_to_response('admin_doc/view_detail.html', { 'name': view, 'summary': title, 'body': body, @@ -142,7 +142,7 @@ def model_index(request): return missing_docutils_page(request) m_list = [m._meta for m in models.get_models()] - return render_to_response('admin_doc/model_index', {'models': m_list}, context_instance=RequestContext(request)) + return render_to_response('admin_doc/model_index.html', {'models': m_list}, context_instance=RequestContext(request)) model_index = staff_member_required(model_index) def model_detail(request, app_label, model_name): @@ -167,12 +167,12 @@ def model_detail(request, app_label, model_name): # Gather fields/field descriptions. fields = [] for field in opts.fields: - # ForeignKey is a special case since the field will actually be a - # descriptor that returns the other object + # ForeignKey is a special case since the field will actually be a + # descriptor that returns the other object if isinstance(field, models.ForeignKey): data_type = related_object_name = field.rel.to.__name__ app_label = field.rel.to._meta.app_label - verbose = utils.parse_rst(("the related `%s.%s` object" % (app_label, data_type)), 'model', 'model:' + data_type) + verbose = utils.parse_rst(("the related `%s.%s` object" % (app_label, data_type)), 'model', 'model:' + data_type) else: data_type = get_readable_field_data_type(field) verbose = field.verbose_name @@ -200,7 +200,7 @@ def model_detail(request, app_label, model_name): 'data_type': get_return_data_type(func_name), 'verbose': verbose, }) - + # Gather related objects for rel in opts.get_all_related_objects(): verbose = "related `%s.%s` objects" % (rel.opts.app_label, rel.opts.object_name) @@ -214,7 +214,7 @@ def model_detail(request, app_label, model_name): 'verbose' : utils.parse_rst("number of " + verbose , 'model', 'model:' + opts.module_name), }) - return render_to_response('admin_doc/model_detail', { + return render_to_response('admin_doc/model_detail.html', { 'name': '%s.%s' % (opts.app_label, opts.object_name), 'summary': "Fields on %s objects" % opts.object_name, 'description': model.__doc__, @@ -236,7 +236,7 @@ def template_detail(request, template): 'site': Site.objects.get(pk=settings_mod.SITE_ID), 'order': list(settings_mod.TEMPLATE_DIRS).index(dir), }) - return render_to_response('admin_doc/template_detail', { + return render_to_response('admin_doc/template_detail.html', { 'name': template, 'templates': templates, }, context_instance=RequestContext(request)) @@ -248,7 +248,7 @@ template_detail = staff_member_required(template_detail) def missing_docutils_page(request): """Display an error message for people without docutils""" - return render_to_response('admin_doc/missing_docutils') + return render_to_response('admin_doc/missing_docutils.html') def load_all_installed_template_libraries(): # Load/register all template tag libraries from installed apps. @@ -335,11 +335,11 @@ def simplify_regex(pattern): """ # handle named groups first pattern = named_group_matcher.sub(lambda m: m.group(1), pattern) - + # handle non-named groups pattern = non_named_group_matcher.sub("", pattern) - - # clean up any outstanding regex-y characters. + + # clean up any outstanding regex-y characters. pattern = pattern.replace('^', '').replace('$', '').replace('?', '').replace('//', '/').replace('\\', '') if not pattern.startswith('/'): pattern = '/' + pattern diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 9c274d7cb0..b288ed97a0 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -218,12 +218,12 @@ def render_change_form(model, manipulator, context, add=False, change=False, for } context.update(extra_context) return render_to_response([ - "admin/%s/%s/change_form" % (app_label, opts.object_name.lower()), - "admin/%s/change_form" % app_label, - "admin/change_form"], context_instance=context) + "admin/%s/%s/change_form.html" % (app_label, opts.object_name.lower()), + "admin/%s/change_form.html" % app_label, + "admin/change_form.html"], context_instance=context) def index(request): - return render_to_response('admin/index', {'title': _('Site administration')}, context_instance=template.RequestContext(request)) + return render_to_response('admin/index.html', {'title': _('Site administration')}, context_instance=template.RequestContext(request)) index = staff_member_required(never_cache(index)) def add_stage(request, app_label, model_name, show_delete=False, form_url='', post_url=None, post_url_continue='../%s/', object_id_override=None): @@ -515,9 +515,9 @@ def delete_stage(request, app_label, model_name, object_id): "perms_lacking": perms_needed, "opts": model._meta, } - return render_to_response(["admin/%s/%s/delete_confirmation" % (app_label, opts.object_name.lower() ), - "admin/%s/delete_confirmation" % app_label , - "admin/delete_confirmation"], extra_context, context_instance=template.RequestContext(request)) + return render_to_response(["admin/%s/%s/delete_confirmation.html" % (app_label, opts.object_name.lower() ), + "admin/%s/delete_confirmation.html" % app_label , + "admin/delete_confirmation.html"], extra_context, context_instance=template.RequestContext(request)) delete_stage = staff_member_required(never_cache(delete_stage)) def history(request, app_label, model_name, object_id): @@ -535,9 +535,9 @@ def history(request, app_label, model_name, object_id): 'module_name': capfirst(model._meta.verbose_name_plural), 'object': obj, } - return render_to_response(["admin/%s/%s/object_history" % (app_label, model._meta.object_name.lower()), - "admin/%s/object_history" % app_label , - "admin/object_history"], extra_context, context_instance=template.RequestContext(request)) + return render_to_response(["admin/%s/%s/object_history.html" % (app_label, model._meta.object_name.lower()), + "admin/%s/object_history.html" % app_label , + "admin/object_history.html"], extra_context, context_instance=template.RequestContext(request)) history = staff_member_required(never_cache(history)) class ChangeList(object): @@ -734,7 +734,7 @@ def change_list(request, app_label, model_name): 'cl': cl, }) c.update({'has_add_permission': c['perms'][app_label][cl.opts.get_add_permission()]}), - return render_to_response(['admin/%s/%s/change_list' % (app_label, cl.opts.object_name.lower()), - 'admin/%s/change_list' % app_label, - 'admin/change_list'], context_instance=c) + return render_to_response(['admin/%s/%s/change_list.html' % (app_label, cl.opts.object_name.lower()), + 'admin/%s/change_list.html' % app_label, + 'admin/change_list.html'], context_instance=c) change_list = staff_member_required(never_cache(change_list)) diff --git a/django/contrib/admin/views/template.py b/django/contrib/admin/views/template.py index 47e6d04e68..f73b9e4218 100644 --- a/django/contrib/admin/views/template.py +++ b/django/contrib/admin/views/template.py @@ -23,7 +23,7 @@ def template_validator(request): errors = manipulator.get_validation_errors(new_data) if not errors: request.user.add_message('The template is valid.') - return render_to_response('admin/template_validator', { + return render_to_response('admin/template_validator.html', { 'title': 'Template validator', 'form': forms.FormWrapper(manipulator, new_data, errors), }, context_instance=template.RequestContext(request)) diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index f65e561656..6c0c8abe97 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -75,7 +75,7 @@ class PasswordResetForm(forms.Manipulator): domain = current_site.domain else: site_name = domain = domain_override - t = loader.get_template('registration/password_reset_email') + t = loader.get_template('registration/password_reset_email.html') c = { 'new_password': new_pass, 'email': self.user_cache.email, diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index 8cf21c0d52..f919f82419 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -25,7 +25,7 @@ def login(request): else: errors = {} request.session.set_test_cookie() - return render_to_response('registration/login', { + return render_to_response('registration/login.html', { 'form': forms.FormWrapper(manipulator, request.POST, errors), REDIRECT_FIELD_NAME: redirect_to, 'site_name': Site.objects.get_current().name, @@ -36,7 +36,7 @@ def logout(request, next_page=None): try: del request.session[SESSION_KEY] except KeyError: - return render_to_response('registration/logged_out', {'title': 'Logged out'}, context_instance=RequestContext(request)) + return render_to_response('registration/logged_out.html', {'title': 'Logged out'}, context_instance=RequestContext(request)) else: # Redirect to this page until the session has been cleared. return HttpResponseRedirect(next_page or request.path) @@ -61,11 +61,11 @@ def password_reset(request, is_admin_site=False): else: form.save() return HttpResponseRedirect('%sdone/' % request.path) - return render_to_response('registration/password_reset_form', {'form': forms.FormWrapper(form, new_data, errors)}, + return render_to_response('registration/password_reset_form.html', {'form': forms.FormWrapper(form, new_data, errors)}, context_instance=RequestContext(request)) def password_reset_done(request): - return render_to_response('registration/password_reset_done', context_instance=RequestContext(request)) + return render_to_response('registration/password_reset_done.html', context_instance=RequestContext(request)) def password_change(request): new_data, errors = {}, {} @@ -76,9 +76,9 @@ def password_change(request): if not errors: form.save(new_data) return HttpResponseRedirect('%sdone/' % request.path) - return render_to_response('registration/password_change_form', {'form': forms.FormWrapper(form, new_data, errors)}, + return render_to_response('registration/password_change_form.html', {'form': forms.FormWrapper(form, new_data, errors)}, context_instance=RequestContext(request)) password_change = login_required(password_change) def password_change_done(request): - return render_to_response('registration/password_change_done', context_instance=RequestContext(request)) + return render_to_response('registration/password_change_done.html', context_instance=RequestContext(request)) diff --git a/django/contrib/comments/views/comments.py b/django/contrib/comments/views/comments.py index cc5b428b40..2a337aaa95 100644 --- a/django/contrib/comments/views/comments.py +++ b/django/contrib/comments/views/comments.py @@ -232,7 +232,7 @@ def post_comment(request): return field_list comment = errors and '' or manipulator.get_comment(new_data) comment_form = CommentFormWrapper(manipulator, new_data, errors, rating_choices) - return render_to_response('comments/preview', { + return render_to_response('comments/preview.html', { 'comment': comment, 'comment_form': comment_form, 'options': options, @@ -300,7 +300,7 @@ def post_free_comment(request): errors = manipulator.get_validation_errors(new_data) if errors or request.POST.has_key('preview'): comment = errors and '' or manipulator.get_comment(new_data) - return render_to_response('comments/free_preview', { + return render_to_response('comments/free_preview.html', { 'comment': comment, 'comment_form': forms.FormWrapper(manipulator, new_data, errors), 'options': options, @@ -337,4 +337,4 @@ def comment_was_posted(request): obj = content_type.get_object_for_this_type(pk=object_id) except ObjectDoesNotExist: pass - return render_to_response('comments/posted', {'object': obj}, context_instance=RequestContext(request)) + return render_to_response('comments/posted.html', {'object': obj}, context_instance=RequestContext(request)) diff --git a/django/contrib/comments/views/karma.py b/django/contrib/comments/views/karma.py index 8667850675..cefcd4fecb 100644 --- a/django/contrib/comments/views/karma.py +++ b/django/contrib/comments/views/karma.py @@ -26,4 +26,4 @@ def vote(request, comment_id, vote): karma.vote(request.user.id, comment_id, rating) # Reload comment to ensure we have up to date karma count comment = comments.get_object(pk=comment_id) - return render_to_response('comments/karma_vote_accepted', {'comment': comment}, context_instance=RequestContext(request)) + return render_to_response('comments/karma_vote_accepted.html', {'comment': comment}, context_instance=RequestContext(request)) diff --git a/django/contrib/comments/views/userflags.py b/django/contrib/comments/views/userflags.py index 827424d266..83cf54a6a9 100644 --- a/django/contrib/comments/views/userflags.py +++ b/django/contrib/comments/views/userflags.py @@ -22,7 +22,7 @@ def flag(request, comment_id): if request.POST: userflags.flag(comment, request.user) return HttpResponseRedirect('%sdone/' % request.path) - return render_to_response('comments/flag_verify', {'comment': comment}, context_instance=RequestContext(request)) + return render_to_response('comments/flag_verify.html', {'comment': comment}, context_instance=RequestContext(request)) flag = login_required(flag) def flag_done(request, comment_id): @@ -30,7 +30,7 @@ def flag_done(request, comment_id): comment = comments.get_object(pk=comment_id, site__id__exact=settings.SITE_ID) except comments.CommentDoesNotExist: raise Http404 - return render_to_response('comments/flag_done', {'comment': comment}, context_instance=RequestContext(request)) + return render_to_response('comments/flag_done.html', {'comment': comment}, context_instance=RequestContext(request)) def delete(request, comment_id): """ @@ -55,7 +55,7 @@ def delete(request, comment_id): m = moderatordeletions.ModeratorDeletion(None, request.user.id, comment.id, None) m.save() return HttpResponseRedirect('%sdone/' % request.path) - return render_to_response('comments/delete_verify', {'comment': comment}, context_instance=RequestContext(request)) + return render_to_response('comments/delete_verify.html', {'comment': comment}, context_instance=RequestContext(request)) delete = login_required(delete) def delete_done(request, comment_id): @@ -63,4 +63,4 @@ def delete_done(request, comment_id): comment = comments.get_object(pk=comment_id, site__id__exact=settings.SITE_ID) except comments.CommentDoesNotExist: raise Http404 - return render_to_response('comments/delete_done', {'comment': comment}, context_instance=RequestContext(request)) + return render_to_response('comments/delete_done.html', {'comment': comment}, context_instance=RequestContext(request)) diff --git a/django/contrib/flatpages/views.py b/django/contrib/flatpages/views.py index e9c6be011d..1441f6f3a3 100644 --- a/django/contrib/flatpages/views.py +++ b/django/contrib/flatpages/views.py @@ -4,7 +4,7 @@ from django.shortcuts import get_object_or_404 from django.http import HttpResponse from django.conf import settings -DEFAULT_TEMPLATE = 'flatpages/default' +DEFAULT_TEMPLATE = 'flatpages/default.html' def flatpage(request, url): """ @@ -12,7 +12,7 @@ def flatpage(request, url): Models: `flatpages.flatpages` Templates: Uses the template defined by the ``template_name`` field, - or `flatpages/default` if template_name is not defined. + or `flatpages/default.html` if template_name is not defined. Context: flatpage `flatpages.flatpages` object diff --git a/django/contrib/syndication/feeds.py b/django/contrib/syndication/feeds.py index efcdd18f09..367af4f9ff 100644 --- a/django/contrib/syndication/feeds.py +++ b/django/contrib/syndication/feeds.py @@ -76,11 +76,11 @@ class Feed: ) try: - title_template = loader.get_template('feeds/%s_title' % self.slug) + title_template = loader.get_template('feeds/%s_title.html' % self.slug) except TemplateDoesNotExist: title_template = Template('{{ obj }}') try: - description_template = loader.get_template('feeds/%s_description' % self.slug) + description_template = loader.get_template('feeds/%s_description.html' % self.slug) except TemplateDoesNotExist: description_template = Template('{{ obj }}') diff --git a/django/template/loaders/app_directories.py b/django/template/loaders/app_directories.py index 46b736d464..8a9bfef4b6 100644 --- a/django/template/loaders/app_directories.py +++ b/django/template/loaders/app_directories.py @@ -29,7 +29,7 @@ app_template_dirs = tuple(app_template_dirs) def get_template_sources(template_name, template_dirs=None): for template_dir in app_template_dirs: - yield os.path.join(template_dir, template_name) + settings.TEMPLATE_FILE_EXTENSION + yield os.path.join(template_dir, template_name) def load_template_source(template_name, template_dirs=None): for filepath in get_template_sources(template_name, template_dirs): diff --git a/django/template/loaders/eggs.py b/django/template/loaders/eggs.py index 2e47c985ad..6184aeaccf 100644 --- a/django/template/loaders/eggs.py +++ b/django/template/loaders/eggs.py @@ -15,7 +15,7 @@ def load_template_source(template_name, template_dirs=None): For every installed app, it tries to get the resource (app, template_name). """ if resource_string is not None: - pkg_name = 'templates/' + template_name + settings.TEMPLATE_FILE_EXTENSION + pkg_name = 'templates/' + template_name for app in settings.INSTALLED_APPS: try: return (resource_string(app, pkg_name), 'egg:%s:%s ' % (app, pkg_name)) diff --git a/django/template/loaders/filesystem.py b/django/template/loaders/filesystem.py index ee34c6c715..0c94021fb8 100644 --- a/django/template/loaders/filesystem.py +++ b/django/template/loaders/filesystem.py @@ -8,7 +8,7 @@ def get_template_sources(template_name, template_dirs=None): if not template_dirs: template_dirs = settings.TEMPLATE_DIRS for template_dir in template_dirs: - yield os.path.join(template_dir, template_name) + settings.TEMPLATE_FILE_EXTENSION + yield os.path.join(template_dir, template_name) def load_template_source(template_name, template_dirs=None): tried = [] diff --git a/docs/authentication.txt b/docs/authentication.txt index 69ec812b24..3e40f59379 100644 --- a/docs/authentication.txt +++ b/docs/authentication.txt @@ -220,7 +220,7 @@ previous section). You can tell them apart with ``is_anonymous()``, like so:: # Do something for logged-in users. If you want to use ``request.user`` in your view code, make sure you have -``SessionMiddleware`` and ``AuthenticationMiddleware`` enabled. See the +``SessionMiddleware`` and ``AuthenticationMiddleware`` enabled. See the `session documentation`_ for more information. .. _request objects: http://www.djangoproject.com/documentation/request_response/#httprequest-objects @@ -261,7 +261,7 @@ The simple, raw way to limit access to pages is to check def my_view(request): if request.user.is_anonymous(): - return render_to_response('myapp/login_error') + return render_to_response('myapp/login_error.html') # ... The login_required decorator @@ -548,7 +548,7 @@ a playlist:: # Create the playlist with the given songs. # ... request.user.message_set.create(message="Your playlist was added successfully.") - return render_to_response("playlists/create", context_instance=RequestContext(request)) + return render_to_response("playlists/create.html", context_instance=RequestContext(request)) When you use ``RequestContext``, the currently logged-in user and his/her messages are made available in the `template context`_ as the template variable diff --git a/docs/settings.txt b/docs/settings.txt index 6ef211d508..4e749add37 100644 --- a/docs/settings.txt +++ b/docs/settings.txt @@ -651,14 +651,6 @@ these paths should use Unix-style forward slashes, even on Windows. See the `template documentation`_. -TEMPLATE_FILE_EXTENSION ------------------------ - -Default: ``'.html'`` - -The file extension to append to all template names when searching for -templates. See the `template documentation`_. - TEMPLATE_LOADERS ---------------- diff --git a/docs/syndication_feeds.txt b/docs/syndication_feeds.txt index d234c2b7ec..2db8eadd1a 100644 --- a/docs/syndication_feeds.txt +++ b/docs/syndication_feeds.txt @@ -120,10 +120,11 @@ One thing's left to do. In an RSS feed, each ```` has a ````, put into those elements. * To specify the contents of ``<title>`` and ``<description>``, create - `Django templates`_ called ``feeds/sitenews_title`` and - ``feeds/sitenews_description``, where ``sitenews`` is the ``slug`` - specified in the URLconf for the given feed. The RSS system renders that - template for each item, passing it two template context variables: + `Django templates`_ called ``feeds/sitenews_title.html`` and + ``feeds/sitenews_description.html``, where ``sitenews`` is the ``slug`` + specified in the URLconf for the given feed. Note the ``.html`` extension + is required. The RSS system renders that template for each item, passing + it two template context variables: * ``{{ obj }}`` -- The current object (one of whichever objects you returned in ``items()``). diff --git a/docs/templates.txt b/docs/templates.txt index 22c10caf15..9d137019a0 100644 --- a/docs/templates.txt +++ b/docs/templates.txt @@ -533,9 +533,9 @@ Loads a template and renders it with the current context. This is a way of The template name can either be a variable or a hard-coded (quoted) string, in either single or double quotes. -This example includes the contents of the template ``"foo/bar"``:: +This example includes the contents of the template ``"foo/bar.html"``:: - {% include "foo/bar" %} + {% include "foo/bar.html" %} This example includes the contents of the template whose name is contained in the variable ``template_name``:: @@ -548,9 +548,9 @@ including it. This example produces the output ``"Hello, John"``: * Context: variable ``person`` is set to ``"john"``. * Template:: - {% include "name_snippet" %} + {% include "name_snippet.html" %} - * The ``name_snippet`` template:: + * The ``name_snippet.html`` template:: Hello, {{ person }} diff --git a/docs/templates_python.txt b/docs/templates_python.txt index af54bc9b8b..c40d4e9be2 100644 --- a/docs/templates_python.txt +++ b/docs/templates_python.txt @@ -363,15 +363,8 @@ Loading templates ----------------- Generally, you'll store templates in files on your filesystem rather than using -the low-level ``Template`` API yourself. Save templates in a file with an -".html" extension in a directory specified as a **template directory**. - -If you don't like the requirement that templates have an ".html" extension, -change your ``TEMPLATE_FILE_EXTENSION`` setting. It's set to ``".html"`` by -default. - -Also, the .html extension doesn't mean templates can contain only HTML. They -can contain whatever textual content you want. +the low-level ``Template`` API yourself. Save templates in a directory +specified as a **template directory**. The TEMPLATE_DIRS setting ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -386,7 +379,8 @@ that contain full paths to your template directory(ies). Example:: ) Your templates can go anywhere you want, as long as the directories and -templates are readable by the Web server. +templates are readable by the Web server. They can have any extension you want, +such as ``.html`` or ``.txt`` or whatever. Note that these paths should use Unix-style forward slashes, even on Windows. @@ -404,14 +398,15 @@ Django has two ways to load templates from files: ``select_template`` is just like ``get_template``, except it takes a list of template names. Of the list, it returns the first template that exists. -For example, if you call ``get_template("story_detail")`` and have the above -``TEMPLATE_DIRS`` setting, here are the files Django will look for, in order: +For example, if you call ``get_template("story_detail.html")`` and have the +above ``TEMPLATE_DIRS`` setting, here are the files Django will look for, in +order: * ``/home/html/templates/lawrence.com/story_detail.html`` * ``/home/html/templates/default/story_detail.html`` -If you call ``select_template(["story_253_detail", "story_detail"])``, here's -what Django will look for: +If you call ``select_template(["story_253_detail.html", "story_detail.html"])``, +here's what Django will look for: * ``/home/html/templates/lawrence.com/story_253_detail.html`` * ``/home/html/templates/default/story_253_detail.html`` @@ -425,7 +420,7 @@ When Django finds a template that exists, it stops looking. You can use ``select_template`` for super-flexible "templatability." For example, if you've written a news story and want some stories to have custom templates, use something like - ``select_template(["story_%s_detail" % story.id, "story_detail"])``. + ``select_template(["story_%s_detail.html" % story.id, "story_detail.html"])``. That'll allow you to use a custom template for an individual story, with a fallback template for stories that don't have custom templates. @@ -441,7 +436,7 @@ single directory gets messy. To load a template that's within a subdirectory, just use a slash, like so:: - get_template("news/story_detail") + get_template("news/story_detail.html") Loader types ~~~~~~~~~~~~ @@ -467,7 +462,7 @@ a template loader. Here are the built-in template loaders: INSTALLED_APPS = ('myproject.polls', 'myproject.music') - ...then ``get_template("foo")`` will look for templates in these + ...then ``get_template("foo.html")`` will look for templates in these directories, in this order: * ``/path/to/myproject/polls/templates/foo.html`` diff --git a/docs/tutorial03.txt b/docs/tutorial03.txt index 993c09c83d..ac70cb5642 100644 --- a/docs/tutorial03.txt +++ b/docs/tutorial03.txt @@ -90,7 +90,7 @@ Finally, it calls that ``detail()`` function like so:: The ``poll_id='23'`` part comes from ``(?P<poll_id>\d+)``. Using parenthesis around a pattern "captures" the text matched by that pattern and sends it as an argument -to the view function; the ``?P<poll_id>`` defines the name that will be used to +to the view function; the ``?P<poll_id>`` defines the name that will be used to identify the matched pattern; and \d+ is a regular experession to match a sequence of digits (i.e., a number). @@ -203,7 +203,7 @@ So let's use Django's template system to separate the design from Python:: def index(request): latest_poll_list = Poll.objects.all().order_by('-pub_date') - t = loader.get_template('polls/index') + t = loader.get_template('polls/index.html') c = Context({ 'latest_poll_list': latest_poll_list, }) @@ -227,9 +227,8 @@ find templates -- just as you did in the "Customize the admin look and feel" section of Tutorial 2. When you've done that, create a directory ``polls`` in your template directory. -Within that, create a file called ``index.html``. Django requires that -templates have ".html" extension. Note that our -``loader.get_template('polls/index')`` code from above maps to +Within that, create a file called ``index.html``. Note that our +``loader.get_template('polls/index.html')`` code from above maps to "[template_directory]/polls/index.html" on the filesystem. Put the following code in that template::
{{ app.name }}