Django

Code

Show
Ignore:
Timestamp:
09/08/08 00:19:28 (3 months ago)
Author:
adrian
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/databrowse/templates/databrowse/calendar_day.html

    r7294 r8984  
    77<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> 
    88 
    9 <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> 
     9<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> 
    1010 
    1111<ul class="objectlist"> 
    1212{% for object in object_list %} 
    13 <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> 
     13<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> 
    1414{% endfor %} 
    1515</ul> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/calendar_month.html

    r7294 r8984  
    77<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> 
    88 
    9 <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> 
     9<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> 
    1010 
    1111<ul class="objectlist"> 
    1212{% for object in object_list %} 
    13 <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> 
     13<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> 
    1414{% endfor %} 
    1515</ul> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/choice_detail.html

    r7294 r8984  
    11{% extends "databrowse/base_site.html" %} 
    22 
    3 {% block title %}{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value|escape }}{% endblock %} 
     3{% block title %}{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value }}{% endblock %} 
    44 
    55{% block content %} 
    66 
    7 <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> 
     7<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> 
    88 
    9 <h1>{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value|escape }}</h1> 
     9<h1>{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}: {{ value }}</h1> 
    1010 
    1111<ul class="objectlist"> 
    1212{% for object in object_list %} 
    13 <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> 
     13<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> 
    1414{% endfor %} 
    1515</ul> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/choice_list.html

    r7294 r8984  
    1111<ul class="objectlist"> 
    1212{% for choice in field.choices %} 
    13 <li class="{% cycle 'odd' 'even' %}"><a href="{{ choice.url }}">{{ choice.label|escape }}</a></li> 
     13<li class="{% cycle 'odd' 'even' %}"><a href="{{ choice.url }}">{{ choice.label }}</a></li> 
    1414{% endfor %} 
    1515</ul> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/fieldchoice_detail.html

    r7294 r8984  
    11{% extends "databrowse/base_site.html" %} 
    22 
    3 {% block title %}{{ model.verbose_name_plural|capfirst|escape }} with {{ field.field.verbose_name|escape }} {{ value|escape }}{% endblock %} 
     3{% block title %}{{ model.verbose_name_plural|capfirst }} with {{ field.field.verbose_name }} {{ value }}{% endblock %} 
    44 
    55{% block content %} 
    66 
    7 <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> 
     7<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> 
    88 
    9 <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> 
     9<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> 
    1010 
    1111<ul class="objectlist"> 
    1212{% for object in object_list %} 
    13 <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> 
     13<li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> 
    1414{% endfor %} 
    1515</ul> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/fieldchoice_homepage.html

    r7294 r8984  
    11{% extends "databrowse/base_site.html" %} 
    22 
    3 {% block title %}Browsable fields in {{ model.verbose_name_plural|escape }}{% endblock %} 
     3{% block title %}Browsable fields in {{ model.verbose_name_plural }}{% endblock %} 
    44 
    55{% block content %} 
  • django/trunk/django/contrib/databrowse/templates/databrowse/fieldchoice_list.html

    r7294 r8984  
    11{% extends "databrowse/base_site.html" %} 
    22 
    3 {% block title %}{{ model.verbose_name_plural|capfirst|escape }} by {{ field.field.verbose_name|escape }}{% endblock %} 
     3{% block title %}{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}{% endblock %} 
    44 
    55{% block content %} 
    66 
    7 <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> 
     7<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> 
    88 
    9 <h1>{{ model.verbose_name_plural|capfirst|escape }} by {{ field.field.verbose_name|escape }}</h1> 
     9<h1>{{ model.verbose_name_plural|capfirst }} by {{ field.field.verbose_name }}</h1> 
    1010 
    1111<ul class="objectlist"> 
    1212{% for object in object_list %} 
    13 <li class="{% cycle 'odd' 'even' %}"><a href="{{ object|iriencode }}/">{{ object|escape }}</a></li> 
     13<li class="{% cycle 'odd' 'even' %}"><a href="{{ object|iriencode }}/">{{ object }}</a></li> 
    1414{% endfor %} 
    1515</ul> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/homepage.html

    r7294 r8984  
    1212                <p> 
    1313                {% for object in model.sample_objects %} 
    14                         <a href="{{ object.url }}">{{ object|escape }}</a>,  
     14                        <a href="{{ object.url }}">{{ object }}</a>,  
    1515                {% endfor %} 
    1616                        <a class="more" href="{{ model.url }}">More &rarr;</a> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/model_detail.html

    r7294 r8984  
    1313<ul class="objectlist"> 
    1414{% for object in model.objects %} 
    15     <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> 
     15    <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> 
    1616{% endfor %} 
    1717</ul> 
  • django/trunk/django/contrib/databrowse/templates/databrowse/object_detail.html

    r7294 r8984  
    55{% block content %} 
    66 
    7 <div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ object.model.url }}">{{ object.model.verbose_name_plural|capfirst }}</a> / {{ object|escape }}</div> 
     7<div id="breadcrumbs"><a href="{{ root_url }}">Home</a> / <a href="{{ object.model.url }}">{{ object.model.verbose_name_plural|capfirst }}</a> / {{ object }}</div> 
    88 
    9 <h1>{{ object.model.verbose_name|capfirst }}: {{ object|escape }}</h1> 
     9<h1>{{ object.model.verbose_name|capfirst }}: {{ object }}</h1> 
    1010 
    1111<table class="objectinfo"> 
     
    1616{% if field.urls %} 
    1717{% for value, url in field.urls %} 
    18 {% if url %}<a href="{{ url }}">{% endif %}{{ value|escape }}{% if url %}</a>{% endif %}{% if not forloop.last %}, {% endif %} 
     18{% if url %}<a href="{{ url }}">{% endif %}{{ value }}{% if url %}</a>{% endif %}{% if not forloop.last %}, {% endif %} 
    1919{% endfor %} 
    2020{% else %}None{% endif %} 
     
    3030  <ul class="objectlist"> 
    3131    {% for object in related_object.object_list %} 
    32     <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object|escape }}</a></li> 
     32    <li class="{% cycle 'odd' 'even' %}"><a href="{{ object.url }}">{{ object }}</a></li> 
    3333    {% endfor %} 
    3434  </ul>