Opened 17 years ago
Closed 17 years ago
#4641 closed (fixed)
newforms-admin: fix for displaying field str() value next to raw_id fields
Reported by: | Owned by: | xian | |
---|---|---|---|
Component: | contrib.admin | Version: | newforms-admin |
Severity: | Keywords: | nfa-blocker | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi, here's a simple fix so that newforms-admin displays the current str() representation of a field next to its raw_id input widget.
regards
matthew
Index: django/contrib/admin/widgets.py =================================================================== --- django/contrib/admin/widgets.py (revision 5505) +++ django/contrib/admin/widgets.py (working copy) @@ -65,9 +65,9 @@ output.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % \ (related_url, url, name)) output.append('<img src="%simg/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>' % settings.ADMIN_MEDIA_PREFIX) + if value: + output.append(' <strong>%s</strong>' % self.rel.to.objects.get(id=value)) return u''.join(output) - #if self.change: # TODO - #output.append(' <strong>TODO</strong>') class RelatedFieldWidgetWrapper(object): """
Attachments (3)
Change History (7)
comment:1 by , 17 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 17 years ago
comment:2 by , 17 years ago
Keywords: | nfa-blocker added |
---|
by , 17 years ago
Attachment: | r6898_fk_raw_id_fix.diff added |
---|
same patch karen provided, plus removing the TODO that this fixes. not trying to be picky ;)
comment:3 by , 17 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
by , 17 years ago
Attachment: | 4641_raw_admin_fields_display_fix.diff added |
---|
more than likely the final patch to be committed. posted here to get some last minute feedback.
comment:4 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
This patch also works for the case where the primary key field is not named 'id'