Code

Ticket #4641: r6898_fk_raw_id_fix.diff

File r6898_fk_raw_id_fix.diff, 893 bytes (added by brosner, 7 years ago)

same patch karen provided, plus removing the TODO that this fixes. not trying to be picky ;)

Line 
1diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
2index 26aacf7..51d7d8d 100644
3--- a/django/contrib/admin/widgets.py
4+++ b/django/contrib/admin/widgets.py
5@@ -100,9 +100,9 @@ class ForeignKeyRawIdWidget(forms.TextInput):
6         output.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % \
7             (related_url, url, name))
8         output.append('<img src="%simg/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>' % settings.ADMIN_MEDIA_PREFIX)
9+        if value:
10+            output.append('&nbsp;<strong>%s</strong>' % self.rel.to.objects.get(pk=value))
11         return mark_safe(u''.join(output))
12-        #if self.change: # TODO
13-            #output.append('&nbsp;<strong>TODO</strong>')
14             
15 class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
16     """