diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2008-09-08 05:19:28 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2008-09-08 05:19:28 +0000 |
| commit | 6bdb7b95299717f5137291e09aad420f7f80f2de (patch) | |
| tree | c62d07848fced717c9989d0aa3c8cf4cc3650302 | |
| parent | a5e0c5b182c1f3df113d2ceccb323b3f267ef536 (diff) | |
Fixed #8172 -- Improved a whole bunch of contrib templates (admin, databrowse, admindocs, etc.) to remove unnecessary 'escape' filters, given autoescaping. Also removed unnecessary {% if %} tags and shortened some {% if %}/{% else %} tags to use {% firstof %}. Thanks for the patch, benspaulding
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8984 bcc190cf-cafb-0310-a4f2-bffc1f526a37
34 files changed, 82 insertions, 81 deletions
diff --git a/django/contrib/admin/templates/admin/auth/user/change_password.html b/django/contrib/admin/templates/admin/auth/user/change_password.html index f1c4a8d34a..db40c4a25b 100644 --- a/django/contrib/admin/templates/admin/auth/user/change_password.html +++ b/django/contrib/admin/templates/admin/auth/user/change_password.html @@ -8,8 +8,8 @@ {% block breadcrumbs %}{% if not is_popup %} <div class="breadcrumbs"> <a href="../../../../">{% trans "Home" %}</a> › - <a href="../../">{{ opts.verbose_name_plural|capfirst|escape }}</a> › - <a href="../">{{ original|truncatewords:"18"|escape }}</a> › + <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> › + <a href="../">{{ original|truncatewords:"18" }}</a> › {% trans 'Change password' %} </div> {% endif %}{% endblock %} @@ -23,7 +23,7 @@ </p> {% endif %} -<p>{% blocktrans with original.username|escape as username %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktrans %}</p> +<p>{% blocktrans with original.username as username %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktrans %}</p> <fieldset class="module aligned"> diff --git a/django/contrib/admin/templates/admin/base.html b/django/contrib/admin/templates/admin/base.html index f99e6d88b6..fdf0f28221 100644 --- a/django/contrib/admin/templates/admin/base.html +++ b/django/contrib/admin/templates/admin/base.html @@ -22,22 +22,22 @@ {% block branding %}{% endblock %} </div> {% if user.is_authenticated and user.is_staff %} - <div id="user-tools">{% trans 'Welcome,' %} <strong>{% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}</strong>. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}<a href="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %}</div> + <div id="user-tools">{% trans 'Welcome,' %} <strong>{% firstof user.first_name user.username %}</strong>. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}<a href="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %}</div> {% endif %} {% block nav-global %}{% endblock %} </div> <!-- END Header --> - {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a>{% if title %} › {{ title|escape }}{% endif %}</div>{% endblock %} + {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a>{% if title %} › {{ title }}{% endif %}</div>{% endblock %} {% endif %} {% if messages %} - <ul class="messagelist">{% for message in messages %}<li>{{ message|escape }}</li>{% endfor %}</ul> + <ul class="messagelist">{% for message in messages %}<li>{{ message }}</li>{% endfor %}</ul> {% endif %} <!-- Content --> <div id="content" class="{% block coltype %}colM{% endblock %}"> {% block pretitle %}{% endblock %} - {% block content_title %}{% if title %}<h1>{{ title|escape }}</h1>{% endif %}{% endblock %} + {% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %} {% block content %} {% block object-tools %}{% endblock %} {{ content }} diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html index b66f67edf6..c5a9ea9c90 100644 --- a/django/contrib/admin/templates/admin/change_list.html +++ b/django/contrib/admin/templates/admin/change_list.html @@ -5,7 +5,7 @@ {% block bodyclass %}change-list{% endblock %} -{% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> › <a href="../">{{ app_label|capfirst|escape }}</a> › {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %} +{% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> › <a href="../">{{ app_label|capfirst }}</a> › {{ cl.opts.verbose_name_plural|capfirst }}</div>{% endblock %}{% endif %} {% block coltype %}flex{% endblock %} @@ -13,7 +13,7 @@ <div id="content-main"> {% block object-tools %} {% if has_add_permission %} -<ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul> +<ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}</a></li></ul> {% endif %} {% endblock %} <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist"> diff --git a/django/contrib/admin/templates/admin/delete_confirmation.html b/django/contrib/admin/templates/admin/delete_confirmation.html index 2a6c4b4ad5..42802f57bc 100644 --- a/django/contrib/admin/templates/admin/delete_confirmation.html +++ b/django/contrib/admin/templates/admin/delete_confirmation.html @@ -4,23 +4,23 @@ {% block breadcrumbs %} <div class="breadcrumbs"> <a href="../../../../">{% trans "Home" %}</a> › - <a href="../../../">{{ app_label|capfirst|escape }}</a> › + <a href="../../../">{{ app_label|capfirst }}</a> › <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> › - <a href="../">{{ object|escape|truncatewords:"18" }}</a> › + <a href="../">{{ object|truncatewords:"18" }}</a> › {% trans 'Delete' %} </div> {% endblock %} {% block content %} {% if perms_lacking %} - <p>{% blocktrans with object|escape as escaped_object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p> + <p>{% blocktrans with object as escaped_object %}Deleting the {{ object_name }} '{{ escaped_object }}' would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p> <ul> {% for obj in perms_lacking %} <li>{{ obj }}</li> {% endfor %} </ul> {% else %} - <p>{% blocktrans with object|escape as escaped_object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktrans %}</p> + <p>{% blocktrans with object as escaped_object %}Are you sure you want to delete the {{ object_name }} "{{ escaped_object }}"? All of the following related items will be deleted:{% endblocktrans %}</p> <ul>{{ deleted_objects|unordered_list }}</ul> <form action="" method="post"> <div> diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html index d77d63c676..e21cf10dea 100644 --- a/django/contrib/admin/templates/admin/edit_inline/tabular.html +++ b/django/contrib/admin/templates/admin/edit_inline/tabular.html @@ -3,13 +3,13 @@ <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}"> {{ inline_admin_formset.formset.management_form }} <fieldset class="module"> - <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst|escape }}</h2> + <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2> {{ inline_admin_formset.formset.non_form_errors }} <table> <thead><tr> {% for field in inline_admin_formset.fields %} {% if not field.is_hidden %} - <th {% if forloop.first %}colspan="2"{% endif %}>{{ field.label|capfirst|escape }}</th> + <th {% if forloop.first %}colspan="2"{% endif %}>{{ field.label|capfirst }}</th> {% endif %} {% endfor %} {% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %} diff --git a/django/contrib/admin/templates/admin/filter.html b/django/contrib/admin/templates/admin/filter.html index bcc64ac7e4..9ef69ffda7 100644 --- a/django/contrib/admin/templates/admin/filter.html +++ b/django/contrib/admin/templates/admin/filter.html @@ -1,8 +1,8 @@ {% load i18n %} -<h3>{% blocktrans with title|escape as filter_title %} By {{ filter_title }} {% endblocktrans %}</h3> +<h3>{% blocktrans with title as filter_title %} By {{ filter_title }} {% endblocktrans %}</h3> <ul> {% for choice in choices %} <li{% if choice.selected %} class="selected"{% endif %}> - <a href="{{ choice.query_string|iriencode }}">{{ choice.display|escape }}</a></li> + <a href="{{ choice.query_string|iriencode }}">{{ choice.display }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html index ba0c381fad..9eb60b8071 100644 --- a/django/contrib/admin/templates/admin/index.html +++ b/django/contrib/admin/templates/admin/index.html @@ -59,7 +59,7 @@ {% else %} <ul class="actionlist"> {% for entry in admin_log %} - <li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">{% if not entry.is_deletion %}<a href="{{ entry.get_admin_url }}">{% endif %}{{ entry.object_repr|escape }}{% if not entry.is_deletion %}</a>{% endif %}<br /><span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span></li> + <li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">{% if not entry.is_deletion %}<a href="{{ entry.get_admin_url }}">{% endif %}{{ entry.object_repr }}{% if not entry.is_deletion %}</a>{% endif %}<br /><span class="mini quiet">{% filter capfirst %}{% trans entry.content_type.name %}{% endfilter %}</span></li> {% endfor %} </ul> {% endif %} diff --git a/django/contrib/admin/templates/admin/object_history.html b/django/contrib/admin/templates/admin/object_history.html index 5c357b224d..38b1c34ac8 100644 --- a/django/contrib/admin/templates/admin/object_history.html +++ b/django/contrib/admin/templates/admin/object_history.html @@ -4,7 +4,7 @@ {% block breadcrumbs %} <div class="breadcrumbs"> <a href="../../../../">{% trans 'Home' %}</a> › - <a href="../../../">{{ app_label|capfirst|escape }}</a> › + <a href="../../../">{{ app_label|capfirst }}</a> › <a href="../../">{{ module_name }}</a> › <a href="../">{{ object|truncatewords:"18" }}</a> › {% trans 'History' %} @@ -28,7 +28,7 @@ {% for action in action_list %} <tr> <th scope="row">{{ action.action_time|date:_("DATETIME_FORMAT") }}</th> - <td>{{ action.user.username }}{% if action.user.first_name %} ({{ action.user.first_name }} {{ action.user.last_name }}){% endif %}</td> + <td>{{ action.user.username }}{% if action.user.get_full_name %} ({{ action.user.get_full_name }}){% endif %}</td> <td>{{ action.change_message }}</td> </tr> {% endfor %} diff --git a/django/contrib/admin/templates/admin/pagination.html b/django/contrib/admin/templates/admin/pagination.html index 0640a4690b..7694e4c5b0 100644 --- a/django/contrib/admin/templates/admin/pagination.html +++ b/django/contrib/admin/templates/admin/pagination.html @@ -6,6 +6,6 @@ {% paginator_number cl i %} {% endfor %} {% endif %} -{{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name|escape }}{% else %}{{ cl.opts.verbose_name_plural }}{% endifequal %} +{{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endifequal %} {% if show_all_url %} <a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %} </p> diff --git a/django/contrib/admin/templates/admin/search_form.html b/django/contrib/admin/templates/admin/search_form.html index b232aa917d..97ef8f18b7 100644 --- a/django/contrib/admin/templates/admin/search_form.html +++ b/django/contrib/admin/templates/admin/search_form.html @@ -4,13 +4,13 @@ <div id="toolbar"><form id="changelist-search" action="" method="get"> <div><!-- DIV needed for valid HTML --> <label for="searchbar"><img src="{% admin_media_prefix %}img/admin/icon_searchbox.png" alt="Search" /></label> -<input type="text" size="40" name="{{ search_var }}" value="{{ cl.query|escape }}" id="searchbar" /> +<input type="text" size="40" name="{{ search_var }}" value="{{ cl.query }}" id="searchbar" /> <input type="submit" value="{% trans 'Go' %}" /> {% if show_result_count %} <span class="small quiet">{% blocktrans count cl.result_count as counter %}1 result{% plural %}{{ counter }} results{% endblocktrans %} (<a href="?{% if cl.is_popup %}pop=1{% endif %}">{% blocktrans with cl.full_result_count as full_result_count %}{{ full_result_count }} total{% endblocktrans %}</a>)</span> {% endif %} {% for pair in cl.params.items %} - {% ifnotequal pair.0 search_var %}<input type="hidden" name="{{ pair.0|escape }}" value="{{ pair.1|escape }}"/>{% endifnotequal %} + {% ifnotequal pair.0 search_var %}<input type="hidden" name="{{ pair.0 }}" value="{{ pair.1 }}"/>{% endifnotequal %} {% endfor %} </div> </form></div> diff --git a/django/contrib/admin/templates/admin/template_validator.html b/django/contrib/admin/templates/admin/template_validator.html index 510614386c..d221807486 100644 --- a/django/contrib/admin/templates/admin/template_validator.html +++ b/django/contrib/admin/templates/admin/template_validator.html @@ -12,11 +12,11 @@ <fieldset class="module aligned"> <div class="form-row{% if form.errors.site %} error{% endif %} required"> - {% if form.errors.site %}{{ form.errors.site }}{% endif %} + {{ form.errors.site }} <h4><label for="id_site">{{ form.site.label }}:</label> {{ form.site }}</h4> </div> <div class="form-row{% if form.errors.template %} error{% endif %} required"> - {% if form.errors.template %}{{ form.errors.template }}{% endif %} + {{ form.errors.template }} <h4><label for="id_template">{{ form.template.label }}:</label> {{ form.template }}</h4> </div> </fieldset> diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index 4facc0ec01..384f852305 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -13,11 +13,11 @@ <form action="" method="post"> -{% if form.old_password.errors %}{{ form.old_password.errors }}{% endif %} +{{ form.old_password.errors }} <p class="aligned wide"><label for="id_old_password">{% trans 'Old password:' %}</label>{{ form.old_password }}</p> -{% if form.new_password1.errors %}{{ form.new_password1.errors }}{% endif %} +{{ form.new_password1.errors }} <p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p> -{% if form.new_password2.errors %}{{ form.new_password2.errors }}{% endif %} +{{ form.new_password2.errors }} <p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p> <p><input type="submit" value="{% trans 'Change my password' %}" /></p> diff --git a/django/contrib/admin/templates/registration/password_reset_confirm.html b/django/contrib/admin/templates/registration/password_reset_confirm.html index 9ba0e5af27..0d3eb385c9 100644 --- a/django/contrib/admin/templates/registration/password_reset_confirm.html +++ b/django/contrib/admin/templates/registration/password_reset_confirm.html @@ -14,9 +14,9 @@ <p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p> <form action="" method="post"> -{% if form.new_password1.errors %}{{ form.new_password1.errors }}{% endif %} +{{ form.new_password1.errors }} <p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p> -{% if form.new_password2.errors %}{{ form.new_password2.errors }}{% endif %} +{{ form.new_password2.errors }} <p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p> <p><input type="submit" value="{% trans 'Change my password' %}" /></p> </form> diff --git a/django/contrib/admin/templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html index 4ecebc77a1..704066c68a 100644 --- a/django/contrib/admin/templates/registration/password_reset_form.html +++ b/django/contrib/admin/templates/registration/password_reset_form.html @@ -12,7 +12,7 @@ <p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}</p> <form action="" method="post"> -{% if form.email.errors %}{{ form.email.errors }}{% endif %} +{{ form.email.errors }} <p><label for="id_email">{% trans 'E-mail address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p> </form> diff --git a/django/contrib/admindocs/templates/admin_doc/model_detail.html b/django/contrib/admindocs/templates/admin_doc/model_detail.html index 414397f23a..828df18377 100644 --- a/django/contrib/admindocs/templates/admin_doc/model_detail.html +++ b/django/contrib/admindocs/templates/admin_doc/model_detail.html @@ -34,7 +34,7 @@ <tr> <td>{{ field.name }}</td> <td>{{ field.data_type }}</td> - <td>{% if field.verbose %}{{ field.verbose }}{% endif %}{% if field.help_text %} - {{ field.help_text|safe }}{% endif %}</td> + <td>{{ field.verbose }}{% if field.help_text %} - {{ field.help_text|safe }}{% endif %}</td> </tr> {% endfor %} </tbody> diff --git a/django/contrib/admindocs/templates/admin_doc/template_detail.html b/django/contrib/admindocs/templates/admin_doc/template_detail.html index a8b02bd189..c04dedc530 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_detail.html +++ b/django/contrib/admindocs/templates/admin_doc/template_detail.html @@ -1,18 +1,18 @@ {% extends "admin/base_site.html" %} {% load i18n %} -{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../../">Home</a> › <a href="../../">Documentation</a> › Templates › {{ name|escape }}</div>{% endblock %} +{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../../">Home</a> › <a href="../../">Documentation</a> › Templates › {{ name }}</div>{% endblock %} -{% block title %}Template: {{ name|escape }}{% endblock %} +{% block title %}Template: {{ name }}{% endblock %} {% block content %} -<h1>Template: "{{ name|escape }}"</h1> +<h1>Template: "{{ name }}"</h1> {% regroup templates|dictsort:"site_id" by site as templates_by_site %} {% for group in templates_by_site %} - <h2>Search path for template "{{ name|escape }}" on {{ group.grouper }}:</h2> + <h2>Search path for template "{{ name }}" on {{ group.grouper }}:</h2> <ol> {% for template in group.list|dictsort:"order" %} - <li><code>{{ template.file|escape }}</code>{% if not template.exists %} <em>(does not exist)</em>{% endif %}</li> + <li><code>{{ template.file }}</code>{% if not template.exists %} <em>(does not exist)</em>{% endif %}</li> {% endfor %} </ol> {% endfor %} diff --git a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html index 902396d416..53383edc23 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_filter_index.html +++ b/django/contrib/admindocs/templates/admin_doc/template_filter_index.html @@ -12,7 +12,7 @@ {% regroup filters|dictsort:"library" by library as filter_libraries %} {% for library in filter_libraries %} <div class="module"> - <h2>{% if library.grouper %}{{ library.grouper }}{% else %}Built-in filters{% endif %}</h2> + <h2>{% firstof library.grouper "Built-in filters" %}</h2> {% if library.grouper %}<p class="small quiet">To use these filters, put <code>{% templatetag openblock %} load {{ library.grouper }} {% templatetag closeblock %}</code> in your template before using the filter.</p><hr />{% endif %} {% for filter in library.list|dictsort:"name" %} <h3 id="{{ filter.name }}">{{ filter.name }}</h3> @@ -33,7 +33,7 @@ {% regroup filters|dictsort:"library" by library as filter_libraries %} {% for library in filter_libraries %} <div class="module"> - <h2>{% if library.grouper %}{{ library.grouper }}{% else %}Built-in filters{% endif %}</h2> + <h2>{% firstof library.grouper "Built-in filters" %}</h2> <ul> {% for filter in library.list|dictsort:"name" %} <li><a href="#{{ filter.name }}">{{ filter.name }}</a></li> diff --git a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html index ea49529393..a4ad66fd96 100644 --- a/django/contrib/admindocs/templates/admin_doc/template_tag_index.html +++ b/django/contrib/admindocs/templates/admin_doc/template_tag_index.html @@ -12,7 +12,7 @@ {% regroup tags|dictsort:"library" by library as tag_libraries %} {% for library in tag_libraries %} <div class="module"> - <h2>{% if library.grouper %}{{ library.grouper }}{% else %}Built-in tags{% endif %}</h2> + <h2>{% firstof library.grouper "Built-in tags" %}</h2> {% if library.grouper %}<p class="small quiet">To use these tags, put <code>{% templatetag openblock %} load {{ library.grouper }} {% templatetag closeblock %}</code> in your template before using the tag.</p><hr />{% endif %} {% for tag in library.list|dictsort:"name" %} <h3 id="{{ tag.name }}">{{ tag.name }}</h3> @@ -33,7 +33,7 @@ {% regroup tags|dictsort:"library" by library as tag_libraries %} {% for library in tag_libraries %} <div class="module"> - <h2>{% if library.grouper %}{{ library.grouper }}{% else %}Built-in tags{% endif %}</h2> + <h2>{% firstof library.grouper "Built-in tags" %}</h2> <ul> {% for tag in library.list|dictsort:"name" %} <li><a href="#{{ tag.name }}">{{ tag.name }}</a></li> diff --git a/django/contrib/admindocs/templates/admin_doc/view_index.html b/django/contrib/admindocs/templates/admin_doc/view_index.html index 4099005828..6b10fa65e3 100644 --- a/django/contrib/admindocs/templates/admin_doc/view_index.html +++ b/django/contrib/admindocs/templates/admin_doc/view_index.html @@ -29,7 +29,7 @@ {% for view in site_views.list|dictsort:"url" %} {% ifchanged %} -<h3><a href="{{ view.module }}.{{ view.name }}/">{{ view.url|escape }}</a></h3> +<h3><a href="{{ view.module }}.{{ view.name }}/">{{ view.url }}</a></h3> <p class="small quiet">View function: {{ view.module }}.{{ view.name }}</p> <p>{{ view.title }}</p> <hr /> diff --git a/django/contrib/databrowse/templates/databrowse/calendar_day.html b/django/contrib/databrowse/templates/databrowse/calendar_day.html index bbb62cc814..b0a221d5d3 100644 --- a/django/contrib/databrowse/templates/databrowse/calendar_day.html +++ b/django/contrib/databrowse/templates/databrowse/calendar_day.html @@ -6,11 +6,11 @@ <div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="../../../../">Calendars</a> / <a href="../../../">By {{ field.verbose_name }}</a> / <a href="../../">{{ day.year }}</a> / <a href="../">{{ day|date:"F" }}</a> / {{ day.day }}</div> -<h1>{{ object_list.count }} {% if object_list.count|pluralize %}{{ model.verbose_name_plural|escape }}{% else %}{{ model.verbose_name|escape }}{% endif %} with {{ field.verbose_name }} on {{ day|date:"F j, Y" }}</h1> +<h1>{{ object_list.count }} {% if object_list.count|pluralize %}{{ model.verbose_name_plural }}{% else %}{{ model.verbose_name }}{% endif %} with {{ field.verbose_name }} on {{ day|date:"F j, Y" }}</h1> <ul class="objectlist"> {% for object in object_list %} -<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> +<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/databrowse/templates/databrowse/calendar_month.html b/django/contrib/databrowse/templates/databrowse/calendar_month.html index 70b7deb75a..f6a616911b 100644 --- a/django/contrib/databrowse/templates/databrowse/calendar_month.html +++ b/django/contrib/databrowse/templates/databrowse/calendar_month.html @@ -6,11 +6,11 @@ <div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="../../../">Calendars</a> / <a href="../../">By {{ field.verbose_name }}</a> / <a href="../">{{ month.year }}</a> / {{ month|date:"F" }}</div> -<h1>{{ object_list.count }} {% if object_list.count|pluralize %}{{ model.verbose_name_plural|escape }}{% else %}{{ model.verbose_name|escape }}{% endif %} with {{ field.verbose_name }} on {{ day|date:"F Y" }}</h1> +<h1>{{ object_list.count }} {% if object_list.count|pluralize %}{{ model.verbose_name_plural }}{% else %}{{ model.verbose_name }}{% endif %} with {{ field.verbose_name }} on {{ day|date:"F Y" }}</h1> <ul class="objectlist"> {% for object in object_list %} -<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> +<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/databrowse/templates/databrowse/choice_detail.html b/django/contrib/databrowse/templates/databrowse/choice_detail.html index 6cb73e73ec..0abc536515 100644 --- a/django/contrib/databrowse/templates/databrowse/choice_detail.html +++ b/django/contrib/databrowse/templates/databrowse/choice_detail.html @@ -1,16 +1,16 @@ {% extends "databrowse/base_site.html" %} -{% block title %}{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value|escape }}{% endblock %} +{% block title %}{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value }}{% endblock %} {% block content %} -<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="{{ field.url }}">By {{ field.field.verbose_name }}</a> / {{ value|escape }}</div> +<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="{{ field.url }}">By {{ field.field.verbose_name }}</a> / {{ value }}</div> -<h1>{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value|escape }}</h1> +<h1>{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value }}</h1> <ul class="objectlist"> {% for object in object_list %} -<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> +<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/databrowse/templates/databrowse/choice_list.html b/django/contrib/databrowse/templates/databrowse/choice_list.html index 95cd88b0bf..58675e82bf 100644 --- a/django/contrib/databrowse/templates/databrowse/choice_list.html +++ b/django/contrib/databrowse/templates/databrowse/choice_list.html @@ -10,7 +10,7 @@ <ul class="objectlist"> {% for choice in field.choices %} -<li class="{% cycle 'odd' 'even' %}"><a href="{{ choice.url }}">{{ choice.label|escape }}</a></li> +<li class="{% cycle 'odd' 'even' %}"><a href="{{ choice.url }}">{{ choice.label }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/databrowse/templates/databrowse/fieldchoice_detail.html b/django/contrib/databrowse/templates/databrowse/fieldchoice_detail.html index 7801f3f631..2dd55d48ac 100644 --- a/django/contrib/databrowse/templates/databrowse/fieldchoice_detail.html +++ b/django/contrib/databrowse/templates/databrowse/fieldchoice_detail.html @@ -1,16 +1,16 @@ {% extends "databrowse/base_site.html" %} -{% block title %}{{ model.verbose_name_plural|capfirst|escape }} with {{ field.field.verbose_name|escape }} {{ value|escape }}{% endblock %} +{% block title %}{{ model.verbose_name_plural|capfirst }} with {{ field.field.verbose_name }} {{ value }}{% endblock %} {% block content %} -<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="../../">Fields</a> / <a href="../">By {{ field.field.verbose_name|escape }}</a> / {{ value|escape }}</div> +<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="../../">Fields</a> / <a href="../">By {{ field.field.verbose_name }}</a> / {{ value }}</div> -<h1>{{ object_list.count }} {% if object_list.count|pluralize %}{{ model.verbose_name_plural|escape }}{% else %}{{ model.verbose_name|escape }}{% endif %} with {{ field.field.verbose_name|escape }} {{ value|escape }}</h1> +<h1>{{ object_list.count }} {% if object_list.count|pluralize %}{{ model.verbose_name_plural }}{% else %}{{ model.verbose_name }}{% endif %} with {{ field.field.verbose_name }} {{ value }}</h1> <ul class="objectlist"> {% for object in object_list %} -<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> +<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/databrowse/templates/databrowse/fieldchoice_homepage.html b/django/contrib/databrowse/templates/databrowse/fieldchoice_homepage.html index 3259824061..b82c22d5b4 100644 --- a/django/contrib/databrowse/templates/databrowse/fieldchoice_homepage.html +++ b/django/contrib/databrowse/templates/databrowse/fieldchoice_homepage.html @@ -1,6 +1,6 @@ {% extends "databrowse/base_site.html" %} -{% block title %}Browsable fields in {{ model.verbose_name_plural|escape }}{% endblock %} +{% block title %}Browsable fields in {{ model.verbose_name_plural }}{% endblock %} {% block content %} diff --git a/django/contrib/databrowse/templates/databrowse/fieldchoice_list.html b/django/contrib/databrowse/templates/databrowse/fieldchoice_list.html index 71b906d3e7..bb60a0e871 100644 --- a/django/contrib/databrowse/templates/databrowse/fieldchoice_list.html +++ b/django/contrib/databrowse/templates/databrowse/fieldchoice_list.html @@ -1,16 +1,16 @@ {% extends "databrowse/base_site.html" %} -{% block title %}{{ model.verbose_name_plural|capfirst|escape }} by {{ field.field.verbose_name|escape }}{% endblock %} +{% block title %}{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}{% endblock %} {% block content %} -<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="../">Fields</a> / By {{ field.field.verbose_name|escape }}</div> +<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a> / <a href="../">Fields</a> / By {{ field.field.verbose_name }}</div> -<h1>{{ model.verbose_name_plural|capfirst|escape }} by {{ field.field.verbose_name|escape }}</h1> +<h1>{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}</h1> <ul class="objectlist"> {% for object in object_list %} -<li class="{% cycle 'odd' 'even' %}"><a href="{{ object|iriencode }}/">{{ object|escape }}</a></li> +<li class="{% cycle 'odd' 'even' %}"><a href="{{ object|iriencode }}/">{{ object }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/databrowse/templates/databrowse/homepage.html b/django/contrib/databrowse/templates/databrowse/homepage.html index 718e577416..0f6708f5fd 100644 --- a/django/contrib/databrowse/templates/databrowse/homepage.html +++ b/django/contrib/databrowse/templates/databrowse/homepage.html @@ -11,7 +11,7 @@ <h2><a href="{{ model.url }}">{{ model.verbose_name_plural|capfirst }}</a></h2> <p> {% for object in model.sample_objects %} - <a href="{{ object.url }}">{{ object|escape }}</a>, + <a href="{{ object.url }}">{{ object }}</a>, {% endfor %} <a class="more" href="{{ model.url }}">More →</a> </p> diff --git a/django/contrib/databrowse/templates/databrowse/model_detail.html b/django/contrib/databrowse/templates/databrowse/model_detail.html index b66bc093dd..11c6808f14 100644 --- a/django/contrib/databrowse/templates/databrowse/model_detail.html +++ b/django/contrib/databrowse/templates/databrowse/model_detail.html @@ -12,7 +12,7 @@ <ul class="objectlist"> {% for object in model.objects %} - <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> + <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> {% endfor %} </ul> diff --git a/django/contrib/databrowse/templates/databrowse/object_detail.html b/django/contrib/databrowse/templates/databrowse/object_detail.html index 7c1bd3e16d..81c37f7736 100644 --- a/django/contrib/databrowse/templates/databrowse/object_detail.html +++ b/django/contrib/databrowse/templates/databrowse/object_detail.html @@ -4,9 +4,9 @@ {% block content %} -<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ object.model.url }}">{{ object.model.verbose_name_plural|capfirst }}</a> / {{ object|escape }}</div> +<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ object.model.url }}">{{ object.model.verbose_name_plural|capfirst }}</a> / {{ object }}</div> -<h1>{{ object.model.verbose_name|capfirst }}: {{ object|escape }}</h1> +<h1>{{ object.model.verbose_name|capfirst }}: {{ object }}</h1> <table class="objectinfo"> {% for field in object.fields %} @@ -15,7 +15,7 @@ <td> {% if field.urls %} {% for value, url in field.urls %} -{% if url %}<a href="{{ url }}">{% endif %}{{ value|escape }}{% if url %}</a>{% endif %}{% if not forloop.last %}, {% endif %} +{% if url %}<a href="{{ url }}">{% endif %}{{ value }}{% if url %}</a>{% endif %}{% if not forloop.last %}, {% endif %} {% endfor %} {% else %}None{% endif %} </td> @@ -29,7 +29,7 @@ {% if related_object.object_list %} <ul class="objectlist"> {% for object in related_object.object_list %} - <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> + <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> {% endfor %} </ul> {% else %} diff --git a/django/contrib/formtools/templates/formtools/preview.html b/django/contrib/formtools/templates/formtools/preview.html index 983115758f..c53ce91724 100644 --- a/django/contrib/formtools/templates/formtools/preview.html +++ b/django/contrib/formtools/templates/formtools/preview.html @@ -8,7 +8,7 @@ {% for field in form %} <tr> <th>{{ field.label }}:</th> -<td>{{ field.data|escape }}</td> +<td>{{ field.data }}</td> </tr> {% endfor %} </table> diff --git a/django/contrib/gis/templates/gis/admin/openlayers.js b/django/contrib/gis/templates/gis/admin/openlayers.js index 719426127c..17aed153b3 100644 --- a/django/contrib/gis/templates/gis/admin/openlayers.js +++ b/django/contrib/gis/templates/gis/admin/openlayers.js @@ -2,11 +2,11 @@ {% block vars %}var {{ module }} = {}; {{ module }}.map = null; {{ module }}.controls = null; {{ module }}.panel = null; {{ module }}.re = new RegExp("^SRID=\d+;(.+)", "i"); {{ module }}.layers = {}; {{ module }}.wkt_f = new OpenLayers.Format.WKT(); -{{ module }}.is_collection = {% if is_collection %}true{% else %}false{% endif %}; +{{ module }}.is_collection = {{ is_collection|yesno:"true,false" }}; {{ module }}.collection_type = '{{ collection_type }}'; -{{ module }}.is_linestring = {% if is_linestring %}true{% else %}false{% endif %}; -{{ module }}.is_polygon = {% if is_polygon %}true{% else %}false{% endif %}; -{{ module }}.is_point = {% if is_point %}true{% else %}false{% endif %}; +{{ module }}.is_linestring = {{ is_linestring|yesno:"true,false" }}; +{{ module }}.is_polygon = {{ is_polygon|yesno:"true,false" }}; +{{ module }}.is_point = {{ is_point|yesno:"true,false" }}; {% endblock %} {{ module }}.get_ewkt = function(feat){return 'SRID={{ srid }};' + {{ module }}.wkt_f.write(feat);} {{ module }}.read_wkt = function(wkt){ @@ -147,7 +147,7 @@ {% if scale_text %}{{ module }}.map.addControl(new OpenLayers.Control.Scale());{% endif %} {% if layerswitcher %}{{ module }}.map.addControl(new OpenLayers.Control.LayerSwitcher());{% endif %} // Then add optional behavior controls - {% if scrollable %}{% else %}{{ module }}.map.getControlsByClass('OpenLayers.Control.Navigation')[0].disableZoomWheel();{% endif %} + {% if not scrollable %}{{ module }}.map.getControlsByClass('OpenLayers.Control.Navigation')[0].disableZoomWheel();{% endif %} {% endblock %} if (wkt){ {{ module }}.enableEditing(); diff --git a/django/contrib/sitemaps/templates/sitemap.xml b/django/contrib/sitemaps/templates/sitemap.xml index c0d529d62e..30ca3c024e 100644 --- a/django/contrib/sitemaps/templates/sitemap.xml +++ b/django/contrib/sitemaps/templates/sitemap.xml @@ -1,9 +1,9 @@ -{% autoescape off %}<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> {% spaceless %} {% for url in urlset %} <url> - <loc>{{ url.location|escape }}</loc> + <loc>{{ url.location }}</loc> {% if url.lastmod %}<lastmod>{{ url.lastmod|date:"Y-m-d" }}</lastmod>{% endif %} {% if url.changefreq %}<changefreq>{{ url.changefreq }}</changefreq>{% endif %} {% if url.priority %}<priority>{{ url.priority }}</priority>{% endif %} @@ -11,4 +11,3 @@ {% endfor %} {% endspaceless %} </urlset> -{% endautoescape %} diff --git a/django/contrib/sitemaps/templates/sitemap_index.xml b/django/contrib/sitemaps/templates/sitemap_index.xml index 497ae8bb81..f19e622c55 100644 --- a/django/contrib/sitemaps/templates/sitemap_index.xml +++ b/django/contrib/sitemaps/templates/sitemap_index.xml @@ -1,5 +1,4 @@ -{% autoescape off %}<?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> -{% for location in sitemaps %}<sitemap><loc>{{ location|escape }}</loc></sitemap>{% endfor %} +{% for location in sitemaps %}<sitemap><loc>{{ location }}</loc></sitemap>{% endfor %} </sitemapindex> -{% endautoescape %} diff --git a/django/views/static.py b/django/views/static.py index 5a4d3ab55c..4ae4d8e60d 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -73,13 +73,16 @@ DEFAULT_DIRECTORY_INDEX_TEMPLATE = """ <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en-us" /> <meta name="robots" content="NONE,NOARCHIVE" /> - <title>Index of {{ directory|escape }}</title> + <title>Index of {{ directory }}</title> </head> <body> - <h1>Index of {{ directory|escape }}</h1> + <h1>Index of {{ directory }}</h1> <ul> + {% ifnotequal directory "/" %} + <li><a href="../">../</a></li> + {% endifnotequal %} {% for f in file_list %} - <li><a href="{{ f|urlencode }}">{{ f|escape }}</a></li> + <li><a href="{{ f|urlencode }}">{{ f }}</a></li> {% endfor %} </ul> </body> |
