tickets_full: 162

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
162 2005-07-22 17:57:21 2006-10-27 11:56:15 2019-06-24 00:16:59.631647 Unreviewed closed contrib.admin defect minor   fixed admin log accesses __repr__ too late (w/patch) If a meta.Model class has a repr function like this: {{{ def __repr__(self): return "Object #%s" % (self.id,) }}} When the object is deleted through the administration interface, the user interface shows that: {{{The object "Object #None" was deleted successfully.}}} A similar message appears in the admin log. It would suggest that the object's representation should be cached before it is deleted for display in the UI and logs. This quick and simple patch fixes the problem: {{{ Index: django/views/admin/main.py =================================================================== --- django/views/admin/main.py (revision 293) +++ django/views/admin/main.py (working copy) @@ -1056,8 +1059,8 @@ if request.POST: # The user has already confirmed the deletion. if perms_needed: raise PermissionDenied + obj_repr = repr(obj) obj.delete() - obj_repr = repr(obj) log.log_action(request.user.id, opts.get_content_type_id(), object_id, obj_repr, log.DELETION) request.user.add_message('The %s "%s" was deleted successfully.' % (opts.verbose_name, obj_repr)) return HttpResponseRedirect("../../") }}} adrian mfenniak@pobox.com   0 0 0 0 0 0
Powered by Datasette · Query took 2.474ms