LogEntry objects have no unicode method
|Reported by:||Owned by:||ShawnMilo|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||yes|
This only, as far as I can tell, affects the admin view for deleting objects. When get_deleted_objects is called on an object (eg: an auth.models.User instance) it can find the associated log entries, and display them as part of the list of objects to be culled; as it stands at the moment, when the template displays the data, it just says
LogEntry object or some such.
I attach a simple patch that attempts to resolve that by providing a unicode representation of the logentry type, based on whether its an addition, change or deletion. The wording and string formatting takes its cues from the construct_change_message method on ModelAdmin.
As far as I can foresee, having a default representation of some sort would not provide any obstacles, as any usage of log entries currently in use will either be assembling the data itself (as the
get_admin_log templatetag does), or using a proxy object to do it, which would have to provide its own unicode (which would take precedence).
I'm not sure there's a legitimate case for a LogEntry not having an object_repr or change_message (both of which are utilised in the patch), but if there is, I've not handled it at current.
Change History (20)
comment:1 Changed 6 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|