diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 93e9b0799b..37cdb91c3c 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -222,7 +222,8 @@ def items_for_result(cl, result): attr = str(cl.to_field) else: attr = pk - result_id = repr(force_unicode(getattr(result, attr)))[1:] + value = result.serializable_value(attr) + result_id = repr(force_unicode(value))[1:] yield mark_safe(u'<%s%s>%s' % \ (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)) else: