Ticket #6396: better_patch-6396.diff

File better_patch-6396.diff, 2.3 KB (added by Martin Diers <martin@…>, 7 years ago)

Much less intrusive patch to address this problem.

  • Users/mwdiers/Documents/workspace/django-trunk/django/contrib/admin/templates/admin/change_list_results.html

     
    1010</thead>
    1111<tbody>
    1212{% for result in results %}
    13 <tr class="{% cycle 'row1' 'row2' %}">{% for item in result %}{{ item }}{% endfor %}</tr>
     13<tr class="{% cycle 'row1' 'row2' %}">
     14{% for item in result %}<{{ item.table_tag }} {{ item.row_class }}>{% if item.url %}<a href="{{ item.url }}" {{ item.event }}>{{ item.result }}</a>{% else %}{{ item.result }}{% endif %}</{{ item.table_tag }}>{% endfor %}
     15</tr>
    1416{% endfor %}
    1517</tbody>
    1618</table>
  • Users/mwdiers/Documents/workspace/django-trunk/django/contrib/admin/templatetags/admin_list.py

     
    196196            # Convert the pk to something that can be used in Javascript.
    197197            # Problem cases are long ints (23L) and non-ASCII strings.
    198198            result_id = repr(force_unicode(getattr(result, pk)))[1:]
    199             yield mark_safe(u'<%s%s><a href="%s"%s>%s</a></%s>' % \
    200                 (table_tag, row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %s); return false;"' % result_id or ''), conditional_escape(result_repr), table_tag))
     199            yield {'row_class': row_class, 'url': url, 'event': (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %s); return false;"' % result_id or ''), 'result': conditional_escape(result_repr), 'table_tag': table_tag}               
    201200        else:
    202             yield mark_safe(u'<td%s>%s</td>' % (row_class, conditional_escape(result_repr)))
     201            yield {'row_class': row_class, 'url': '', 'event': '', 'result': conditional_escape(result_repr), 'table_tag': 'td'}               
    203202
    204203def results(cl):
    205204    for res in cl.result_list:
Back to Top