Code

Ticket #5715: admin_iriencode.diff

File admin_iriencode.diff, 3.4 KB (added by MiCHiLU, 7 years ago)
Line 
1Index: django/contrib/admin/templatetags/admin_list.py
2===================================================================
3--- django/contrib/admin/templatetags/admin_list.py     (revision 6468)
4+++ django/contrib/admin/templatetags/admin_list.py     (working copy)
5@@ -7,7 +7,7 @@
6 from django.utils.html import escape
7 from django.utils.text import capfirst
8 from django.utils.translation import get_date_formats, get_partial_date_formats, ugettext as _
9-from django.utils.encoding import smart_unicode, smart_str, force_unicode
10+from django.utils.encoding import smart_unicode, smart_str, force_unicode, iri_to_uri
11 from django.template import Library
12 import datetime
13 
14@@ -21,7 +21,9 @@
15     elif i == cl.page_num:
16         return u'<span class="this-page">%d</span> ' % (i+1)
17     else:
18-        return u'<a href="%s"%s>%d</a> ' % (cl.get_query_string({PAGE_VAR: i}), (i == cl.paginator.pages-1 and ' class="end"' or ''), i+1)
19+        return u'<a href="%s"%s>%d</a> ' % (
20+            iri_to_uri(cl.get_query_string({PAGE_VAR: i})),
21+            (i == cl.paginator.pages-1 and ' class="end"' or ''), i+1)
22 paginator_number = register.simple_tag(paginator_number)
23 
24 def pagination(cl):
25Index: django/contrib/admin/templates/admin/pagination.html
26===================================================================
27--- django/contrib/admin/templates/admin/pagination.html        (revision 6468)
28+++ django/contrib/admin/templates/admin/pagination.html        (working copy)
29@@ -7,5 +7,5 @@
30 {% endfor %}
31 {% endif %}
32 {{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name|escape }}{% else %}{{ cl.opts.verbose_name_plural|escape }}{% endifequal %}
33-{% if show_all_url %}&nbsp;&nbsp;<a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %}
34+{% if show_all_url %}&nbsp;&nbsp;<a href="{{ show_all_url|iriencode }}" class="showall">{% trans 'Show all' %}</a>{% endif %}
35 </p>
36Index: django/contrib/admin/templates/admin/change_list_results.html
37===================================================================
38--- django/contrib/admin/templates/admin/change_list_results.html       (revision 6468)
39+++ django/contrib/admin/templates/admin/change_list_results.html       (working copy)
40@@ -3,7 +3,7 @@
41 <thead>
42 <tr>
43 {% for header in result_headers %}<th{{ header.class_attrib }}>
44-{% if header.sortable %}<a href="{{ header.url }}">{% endif %}
45+{% if header.sortable %}<a href="{{ header.url|iriencode }}">{% endif %}
46 {{ header.text|capfirst }}
47 {% if header.sortable %}</a>{% endif %}</th>{% endfor %}
48 </tr>
49Index: django/contrib/admin/templates/admin/date_hierarchy.html
50===================================================================
51--- django/contrib/admin/templates/admin/date_hierarchy.html    (revision 6468)
52+++ django/contrib/admin/templates/admin/date_hierarchy.html    (working copy)
53@@ -1,9 +1,9 @@
54 {% if show %}
55 <div class="xfull">
56 <ul class="toplinks">
57-{% if back %}<li class="date-back"><a href="{{ back.link }}">&lsaquo; {{ back.title|escape }}</a></li>{% endif %}
58+{% if back %}<li class="date-back"><a href="{{ back.link|iriencode }}">&lsaquo; {{ back.title|escape }}</a></li>{% endif %}
59 {% for choice in choices %}
60-<li> {% if choice.link %}<a href="{{ choice.link }}">{% endif %}{{ choice.title|escape }}{% if choice.link %}</a>{% endif %}</li>
61+<li> {% if choice.link %}<a href="{{ choice.link|iriencode }}">{% endif %}{{ choice.title|escape }}{% if choice.link %}</a>{% endif %}</li>
62 {% endfor %}
63 </ul><br class="clear" />
64 </div>