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.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-12-08 08:16:26 +00:00
parent d662ef5540
commit 662e12b45c
1 changed files with 2 additions and 1 deletions

View File

@ -222,7 +222,8 @@ def items_for_result(cl, result):
attr = str(cl.to_field) attr = str(cl.to_field)
else: else:
attr = pk 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>' % \ 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)) (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: else: