From 6bdb7b95299717f5137291e09aad420f7f80f2de Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 8 Sep 2008 05:19:28 +0000 Subject: [PATCH] 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 --- .../templates/admin/auth/user/change_password.html | 6 +++--- django/contrib/admin/templates/admin/base.html | 8 ++++---- django/contrib/admin/templates/admin/change_list.html | 4 ++-- .../admin/templates/admin/delete_confirmation.html | 8 ++++---- .../admin/templates/admin/edit_inline/tabular.html | 4 ++-- django/contrib/admin/templates/admin/filter.html | 4 ++-- django/contrib/admin/templates/admin/index.html | 2 +- .../contrib/admin/templates/admin/object_history.html | 4 ++-- django/contrib/admin/templates/admin/pagination.html | 2 +- django/contrib/admin/templates/admin/search_form.html | 4 ++-- .../admin/templates/admin/template_validator.html | 4 ++-- .../templates/registration/password_change_form.html | 6 +++--- .../templates/registration/password_reset_confirm.html | 4 ++-- .../templates/registration/password_reset_form.html | 2 +- .../admindocs/templates/admin_doc/model_detail.html | 2 +- .../admindocs/templates/admin_doc/template_detail.html | 10 +++++----- .../templates/admin_doc/template_filter_index.html | 4 ++-- .../templates/admin_doc/template_tag_index.html | 4 ++-- .../admindocs/templates/admin_doc/view_index.html | 2 +- .../databrowse/templates/databrowse/calendar_day.html | 4 ++-- .../templates/databrowse/calendar_month.html | 4 ++-- .../databrowse/templates/databrowse/choice_detail.html | 8 ++++---- .../databrowse/templates/databrowse/choice_list.html | 2 +- .../templates/databrowse/fieldchoice_detail.html | 8 ++++---- .../templates/databrowse/fieldchoice_homepage.html | 2 +- .../templates/databrowse/fieldchoice_list.html | 8 ++++---- .../databrowse/templates/databrowse/homepage.html | 2 +- .../databrowse/templates/databrowse/model_detail.html | 2 +- .../databrowse/templates/databrowse/object_detail.html | 8 ++++---- .../contrib/formtools/templates/formtools/preview.html | 2 +- django/contrib/gis/templates/gis/admin/openlayers.js | 10 +++++----- django/contrib/sitemaps/templates/sitemap.xml | 5 ++--- django/contrib/sitemaps/templates/sitemap_index.xml | 5 ++--- django/views/static.py | 9 ++++++--- 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 %} {% endif %}{% endblock %} @@ -23,7 +23,7 @@

{% endif %} -

{% blocktrans with original.username|escape as username %}Enter a new password for the user {{ username }}.{% endblocktrans %}

+

{% blocktrans with original.username as username %}Enter a new password for the user {{ username }}.{% endblocktrans %}

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 %} {% if user.is_authenticated and user.is_staff %} -
{% trans 'Welcome,' %} {% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %}
+
{% trans 'Welcome,' %} {% firstof user.first_name user.username %}. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}{% trans 'Documentation' %} / {% endif %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %}
{% endif %} {% block nav-global %}{% endblock %} - {% block breadcrumbs %}{% endblock %} + {% block breadcrumbs %}{% endblock %} {% endif %} {% if messages %} - + {% endif %}
{% block pretitle %}{% endblock %} - {% block content_title %}{% if title %}

{{ title|escape }}

{% endif %}{% endblock %} + {% block content_title %}{% if title %}

{{ title }}

{% 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 %}{% endblock %}{% endif %} +{% if not is_popup %}{% block breadcrumbs %}{% endblock %}{% endif %} {% block coltype %}flex{% endblock %} @@ -13,7 +13,7 @@
{% block object-tools %} {% if has_add_permission %} - + {% endif %} {% endblock %}
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 %} {% endblock %} {% block content %} {% if perms_lacking %} -

{% 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 %}

+

{% 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 %}

    {% for obj in perms_lacking %}
  • {{ obj }}
  • {% endfor %}
{% else %} -

{% 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 %}

+

{% 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 %}

    {{ deleted_objects|unordered_list }}
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 @@