Opened 18 years ago

Closed 18 years ago

Last modified 17 years ago

#1054 closed defect (fixed)

[magic-removal][patch] Change lists in new-admin still use __repr__() instead of __str__()

Reported by: GomoX <gomo@…> 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)

magic_removal-admin_list_repr_to_str.diff (1.4 KB ) - added by Tom Tobin <korpios@…> 18 years ago.
Fix admin_list using __repr__ where it should use __str__
magic_removal-admin_list_repr_to_str-2.diff (1.4 KB ) - added by Tom Tobin <korpios@…> 18 years ago.
Fix admin_list using __repr__ where it should use __str__ (fresh for recent changes)

Download all attachments as: .zip

Change History (9)

comment:1 by GomoX <gomo@…>, 18 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 anonymous, 18 years ago

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 ...

comment:3 by GomoX <gomo@…>, 18 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:4 by bruce@…, 18 years ago

Does the patch from ticket:889 help here?

comment:5 by Tom Tobin <korpios@…>, 18 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 Tom Tobin <korpios@…>, 18 years ago

Fix admin_list using __repr__ where it should use __str__

by Tom Tobin <korpios@…>, 18 years ago

Fix admin_list using __repr__ where it should use __str__ (fresh for recent changes)

comment:6 by Tom Tobin <korpios@…>, 18 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 Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [2340]) magic-removal: Fixed #1054 -- Changed admin changelist to use str(), not repr()

Note: See TracTickets for help on using tickets.
Back to Top