Fix admindocs on Python 3, where None cannot be sorted with strings.

This fixes two tests in admin_views which were failing on Python 3, but only if
the tests were run with docutils installed.
This commit is contained in:
Carl Meyer 2013-02-12 17:10:36 -07:00
parent fafee74306
commit 3a002db6f1
3 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@
<h2>{% firstof library.grouper "Built-in filters" %}</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 %} {% 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" %} {% for filter in library.list|dictsort:"name" %}
<h3 id="{{ library.grouper|default_if_none:"built_in" }}-{{ filter.name }}">{{ filter.name }}</h3> <h3 id="{{ library.grouper|default:"built_in" }}-{{ filter.name }}">{{ filter.name }}</h3>
{{ filter.title }} {{ filter.title }}
{{ filter.body }} {{ filter.body }}
{% if not forloop.last %}<hr />{% endif %} {% if not forloop.last %}<hr />{% endif %}
@ -43,7 +43,7 @@
<h2>{% firstof library.grouper "Built-in filters" %}</h2> <h2>{% firstof library.grouper "Built-in filters" %}</h2>
<ul> <ul>
{% for filter in library.list|dictsort:"name" %} {% for filter in library.list|dictsort:"name" %}
<li><a href="#{{ library.grouper|default_if_none:"built_in" }}-{{ filter.name }}">{{ filter.name }}</a></li> <li><a href="#{{ library.grouper|default:"built_in" }}-{{ filter.name }}">{{ filter.name }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View File

@ -22,7 +22,7 @@
<h2>{% firstof library.grouper "Built-in tags" %}</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 %} {% 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" %} {% for tag in library.list|dictsort:"name" %}
<h3 id="{{ library.grouper|default_if_none:"built_in" }}-{{ tag.name }}">{{ tag.name }}</h3> <h3 id="{{ library.grouper|default:"built_in" }}-{{ tag.name }}">{{ tag.name }}</h3>
<h4>{{ tag.title|striptags }}</h4> <h4>{{ tag.title|striptags }}</h4>
{{ tag.body }} {{ tag.body }}
{% if not forloop.last %}<hr />{% endif %} {% if not forloop.last %}<hr />{% endif %}
@ -43,7 +43,7 @@
<h2>{% firstof library.grouper "Built-in tags" %}</h2> <h2>{% firstof library.grouper "Built-in tags" %}</h2>
<ul> <ul>
{% for tag in library.list|dictsort:"name" %} {% for tag in library.list|dictsort:"name" %}
<li><a href="#{{ library.grouper|default_if_none:"built_in" }}-{{ tag.name }}">{{ tag.name }}</a></li> <li><a href="#{{ library.grouper|default:"built_in" }}-{{ tag.name }}">{{ tag.name }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>

View File

@ -62,7 +62,7 @@ def template_tag_index(request):
for key in metadata: for key in metadata:
metadata[key] = utils.parse_rst(metadata[key], 'tag', _('tag:') + tag_name) metadata[key] = utils.parse_rst(metadata[key], 'tag', _('tag:') + tag_name)
if library in template.builtins: if library in template.builtins:
tag_library = None tag_library = ''
else: else:
tag_library = module_name.split('.')[-1] tag_library = module_name.split('.')[-1]
tags.append({ tags.append({
@ -97,7 +97,7 @@ def template_filter_index(request):
for key in metadata: for key in metadata:
metadata[key] = utils.parse_rst(metadata[key], 'filter', _('filter:') + filter_name) metadata[key] = utils.parse_rst(metadata[key], 'filter', _('filter:') + filter_name)
if library in template.builtins: if library in template.builtins:
tag_library = None tag_library = ''
else: else:
tag_library = module_name.split('.')[-1] tag_library = module_name.split('.')[-1]
filters.append({ filters.append({