Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

magic-removal: Fixed #500 -- Removed TEMPLATE_FILE_EXTENSION setting …

…so that template loading requires you to give the full filename, including extension. This applies everywhere, even in the 'extends' and 'include' template tags.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6442fd27bcf116d62ba5108436a28a3ed4df95e5 1 parent 39d42d4
@adrianholovaty adrianholovaty authored
Showing with 124 additions and 140 deletions.
  1. +0 −3  django/conf/global_settings.py
  2. +1 −1  django/contrib/admin/templates/admin/404.html
  3. +1 −1  django/contrib/admin/templates/admin/500.html
  4. +1 −1  django/contrib/admin/templates/admin/base_site.html
  5. +1 −1  django/contrib/admin/templates/admin/change_form.html
  6. +1 −1  django/contrib/admin/templates/admin/change_list.html
  7. +1 −1  django/contrib/admin/templates/admin/delete_confirmation.html
  8. +2 −2 django/contrib/admin/templates/admin/index.html
  9. +1 −1  django/contrib/admin/templates/admin/login.html
  10. +1 −1  django/contrib/admin/templates/admin/object_history.html
  11. +1 −1  django/contrib/admin/templates/admin/template_validator.html
  12. +1 −1  django/contrib/admin/templates/admin_doc/bookmarklets.html
  13. +1 −1  django/contrib/admin/templates/admin_doc/index.html
  14. +1 −1  django/contrib/admin/templates/admin_doc/missing_docutils.html
  15. +1 −1  django/contrib/admin/templates/admin_doc/model_detail.html
  16. +1 −1  django/contrib/admin/templates/admin_doc/model_index.html
  17. +1 −1  django/contrib/admin/templates/admin_doc/template_detail.html
  18. +1 −1  django/contrib/admin/templates/admin_doc/template_filter_index.html
  19. +1 −1  django/contrib/admin/templates/admin_doc/template_tag_index.html
  20. +1 −1  django/contrib/admin/templates/admin_doc/view_detail.html
  21. +1 −1  django/contrib/admin/templates/admin_doc/view_index.html
  22. +1 −1  django/contrib/admin/templates/registration/logged_out.html
  23. +1 −1  django/contrib/admin/templates/registration/password_change_done.html
  24. +1 −1  django/contrib/admin/templates/registration/password_change_form.html
  25. +1 −1  django/contrib/admin/templates/registration/password_reset_done.html
  26. +1 −1  django/contrib/admin/templates/registration/password_reset_form.html
  27. +1 −1  django/contrib/admin/templates/widget/many_to_many.html
  28. +1 −1  django/contrib/admin/templates/widget/one_to_one.html
  29. +6 −6 django/contrib/admin/templatetags/admin_list.py
  30. +6 −6 django/contrib/admin/templatetags/admin_modify.py
  31. +1 −1  django/contrib/admin/views/decorators.py
  32. +19 −19 django/contrib/admin/views/doc.py
  33. +13 −13 django/contrib/admin/views/main.py
  34. +1 −1  django/contrib/admin/views/template.py
  35. +1 −1  django/contrib/auth/forms.py
  36. +6 −6 django/contrib/auth/views.py
  37. +3 −3 django/contrib/comments/views/comments.py
  38. +1 −1  django/contrib/comments/views/karma.py
  39. +4 −4 django/contrib/comments/views/userflags.py
  40. +2 −2 django/contrib/flatpages/views.py
  41. +2 −2 django/contrib/syndication/feeds.py
  42. +1 −1  django/template/loaders/app_directories.py
  43. +1 −1  django/template/loaders/eggs.py
  44. +1 −1  django/template/loaders/filesystem.py
  45. +3 −3 docs/authentication.txt
  46. +0 −8 docs/settings.txt
  47. +5 −4 docs/syndication_feeds.txt
  48. +4 −4 docs/templates.txt
  49. +12 −17 docs/templates_python.txt
  50. +4 −5 docs/tutorial03.txt
View
3  django/conf/global_settings.py
@@ -102,9 +102,6 @@
# 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.
View
2  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 %}
View
2  django/contrib/admin/templates/admin/500.html
@@ -1,4 +1,4 @@
-{% extends "admin/base_site" %}
+{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans "Home" %}</a> &rsaquo; {% trans "Server error" %}</div>{% endblock %}
View
2  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 %}
View
2  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 }}
<script type="text/javascript" src="../../../jsi18n/"></script>
View
2  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 %}
View
2  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 %}<a href="../../../../doc/">{% trans 'Documentation' %}</a> / <a href="../../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
{% block breadcrumbs %}
View
4 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 %}
<div class="module">
- <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
+ <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}">
<caption>{{ app.name }}</caption>
{% for model in app.models %}
<tr>
View
2  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 %}
View
2  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 %}<a href="../../../../doc/">{% trans 'Documentation' %}</a> / <a href="../../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
{% block breadcrumbs %}
View
2  django/contrib/admin/templates/admin/template_validator.html
@@ -1,4 +1,4 @@
-{% extends "admin/base_site" %}
+{% extends "admin/base_site.html" %}
{% block content %}
View
2  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 %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> &rsaquo; <a href="../">{% trans "Documentation" %}</a> &rsaquo; {% trans "Bookmarklets" %}</div>{% endblock %}
{% block userlinks %}<a href="../../password_change/">{% trans 'Change password' %}</a> / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../">Home</a> &rsaquo; Documentation</div>{% endblock %}
{% block userlinks %}<a href="../password_change/">{% trans 'Change password' %}</a> / <a href="../logout/">{% trans 'Log out' %}</a>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../">Home</a> &rsaquo; Documentation</div>{% endblock %}
{% block userlinks %}<a href="../password_change/">{% trans 'Change password' %}</a> / <a href="../logout/">{% trans 'Log out' %}</a>{% endblock %}
View
2  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 %}<a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
{% block extrahead %}
View
2  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 %}<div class="breadcrumbs"><a href="../../">Home</a> &rsaquo; <a href="../">Documentation</a> &rsaquo; Models</div>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../../../">Home</a> &rsaquo; <a href="../../">Documentation</a> &rsaquo; Templates &rsaquo; {{ name }}</div>{% endblock %}
{% block userlinks %}<a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../../">Home</a> &rsaquo; <a href="../">Documentation</a> &rsaquo; filters</div>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../../">Home</a> &rsaquo; <a href="../">Documentation</a> &rsaquo; Tags</div>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../../../">Home</a> &rsaquo; <a href="../../">Documentation</a> &rsaquo; <a href="../">Views</a> &rsaquo; {{ name }}</div>{% endblock %}
{% block userlinks %}<a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../../">Home</a> &rsaquo; <a href="../">Documentation</a> &rsaquo; Views</div>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../">{% trans 'Home' %}</a></div>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../">{% trans 'Home' %}</a> &rsaquo; {% trans 'Password change' %}</div>{% endblock %}
View
2  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 %}<a href="../doc/">{% trans 'Documentation' %}</a> / {% trans 'Change password' %} / <a href="../logout/">{% trans 'Log out' %}</a>{% endblock %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% trans 'Home' %}</a> &rsaquo; {% trans 'Password change' %}</div>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../">{% trans 'Home' %}</a> &rsaquo; {% trans 'Password reset' %}</div>{% endblock %}
View
2  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 %}<div class="breadcrumbs"><a href="../">{% trans 'Home' %}</a> &rsaquo; {% trans 'Password reset' %}</div>{% endblock %}
View
2  django/contrib/admin/templates/widget/many_to_many.html
@@ -1 +1 @@
-{% include "widget/foreign" %}
+{% include "widget/foreign.html" %}
View
2  django/contrib/admin/templates/widget/one_to_one.html
@@ -1 +1 @@
-{% include "widget/foreign" %}
+{% include "widget/foreign.html" %}
View
12 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)
View
12 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 @@ def get_nodelist(cls, klass):
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 @@ def get_nodelist(cls, klass):
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 @@ def __init__(self, related_object, field_mapping, original):
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 @@ def __init__(self, related_object, field_mapping, original):
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)
View
2  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,
View
38 django/contrib/admin/views/doc.py
@@ -17,13 +17,13 @@
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 @@ def template_detail(request, template):
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("<var>", 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
View
26 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))
View
2  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))
View
2  django/contrib/auth/forms.py
@@ -75,7 +75,7 @@ def save(self, domain_override=None):
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,
View
12 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))
View
6 django/contrib/comments/views/comments.py
@@ -232,7 +232,7 @@ def ratings(self):
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))
View
2  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))
View
8 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))
View
4 django/contrib/flatpages/views.py
@@ -4,7 +4,7 @@
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
View
4 django/contrib/syndication/feeds.py
@@ -76,11 +76,11 @@ def get_feed(self, url=None):
)
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 }}')
View
2  django/template/loaders/app_directories.py
@@ -29,7 +29,7 @@
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):
View
2  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))
View
2  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 = []
View
6 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
View
8 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
----------------
View
9 docs/syndication_feeds.txt
@@ -120,10 +120,11 @@ One thing's left to do. In an RSS feed, each ``<item>`` has a ``<title>``,
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()``).
View
8 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 }}
View
29 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``
View
9 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::
Please sign in to comment.
Something went wrong with that request. Please try again.