summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-12-08 08:24:32 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-12-08 08:24:32 +0000
commit4dcff3e684f837d31ab1fcc6f33221d682340745 (patch)
tree68eafe75997e5aeaaa185bc1440895aff7844ddb
parentbffb45786297b11e6f189c302d084afca670709a (diff)
[1.0.X] The second part of fixing "related inherited models" display. Handle raw_id values for child models in the admin. Fixed #9461.
I couldn't think of a way to test this automatically and robustly, however, manual testing with the ticket example shows failure before and success afterwards and the fix make sense logically. Backport of r9602 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9604 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/contrib/admin/templatetags/admin_list.py3
1 files changed, 2 insertions, 1 deletions
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><a href="%s"%s>%s</a></%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: