#1054 closed defect (fixed)
[magic-removal][patch] Change lists in new-admin still use __repr__() instead of __str__()
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | contrib.admin | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | gomo@… | Triage Stage: | Design decision needed |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Although [1042] removed pretty much every use of __repr__() where __str__() should have been in place, the change lists in the admin (i.e, when you click on a pluralized model name in the main admin screen, and get a list of the corresponding objects) looks like it's still using __repr__(). I looked in the admin code but I couldn't find the corresponding call or %r appearance.
Attachments (2)
Change History (9)
comment:1 by , 20 years ago
| Summary: | Change lists in new-admin still use !__repr!__() instead of !__str!__() → Change lists in new-admin still use __repr__() instead of __str__() |
|---|
comment:2 by , 20 years ago
comment:3 by , 20 years ago
No, I actually set both __repr__() and __str__() to something unambigous so that I could tell one from the other. The only place in the admin where __repr__() is still used is the change lists, as far as i've seen.
This bug is also obscured by the default python fallback behaviour described in #710.
comment:5 by , 20 years ago
| Summary: | Change lists in new-admin still use __repr__() instead of __str__() → [magic-removal][patch] Change lists in new-admin still use __repr__() instead of __str__() |
|---|
Attaching a patch against magic-removal to fix this issue.
by , 20 years ago
| Attachment: | magic_removal-admin_list_repr_to_str.diff added |
|---|
Fix admin_list using __repr__ where it should use __str__
by , 20 years ago
| Attachment: | magic_removal-admin_list_repr_to_str-2.diff added |
|---|
Fix admin_list using __repr__ where it should use __str__ (fresh for recent changes)
comment:6 by , 20 years ago
Added a fresh patch to take into account recent changes (basically just shifted lines), as it came up as a conflict after a recent svn up on my end.
comment:7 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Are you sure that you not just have a repr in your list_fields? Happened to me after the change: I forgot to change my repr listings in the list_fields to better fields (or to str), so the repr was still called and of course nothing showed in the view, as everything was angular brackets ...