﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2050	"[patch] Display of ""current value"" of raw_id_admin fields wrong"	Christopher Lenz <cmlenz@…>	Adrian Holovaty	"[2827] fixed the display of the current value of a `raw_id_admin` configured field in the admin app. However, what is now displayed is the ID, which doesn't seem all that helpful.

If I'm not mistaken, what '''should''' be displayed here would be the `__str__` of the currently associated foreign object(s). The following patch does that by access `field.name` instead of `field.attname`:

{{{
Index: django/contrib/admin/views/main.py
===================================================================
--- django/contrib/admin/views/main.py  (revision 510)
+++ django/contrib/admin/views/main.py  (working copy)
@@ -143,9 +143,10 @@
             return self._display
         except AttributeError:
             if isinstance(self.field.rel, models.ManyToOneRel):
-                self._display = getattr(self.original, self.field.attname)
+                print `self.original`, `self.field.attname`
+                self._display = getattr(self.original, self.field.name)
             elif isinstance(self.field.rel, models.ManyToManyRel):
-                self._display = "", "".join([str(obj) for obj in getattr(self.original, self.field.attname).all()])
+                self._display = "", "".join([str(obj) for obj in getattr(self.original, self.field.name).all()])
             return self._display
 
     def __repr__(self):
}}}
"	defect	closed	contrib.admin	dev	normal	fixed			Unreviewed	1	0	0	0	0	0
