Open sjdemartini opened 2 years ago
Indeed modifying the base class function is not a good idea.
I don't think we have a choice other than overwriting the function on the child to have a different function.
We could have a metaclass creating that function automatically if we have a field_to_highlight_short_description
attribute, but this would mean creating our own metaclass, which is not really a good idea either.
In any case, the documentation should be updated.
Thanks for the great package! I noticed one issue using
SafeDeleteAdmin
and thehighlight_deleted_field
option, after following the example in the docs:This introduces a bug in that it will override the
SafeDeleteAdmin
'shighlight_deleted_field.short_description
, so all subclasses will end up with the same value, since it's an attribute on the superclass'shighlight_deleted_field
method. Even if multiple subclasses attempt to set the attribute, likeContactAdmin.highlight_deleted_field.short_description = ContactAdmin.field_to_highlight
andOtherAdmin.highlight_deleted_field.short_description = "Foo"
, the one defined last will override all others.One workaround right now is to redefine the
highlight_deleted_field
in every subclass, so that you can attach an attribute that doesn't clobber other usage ofSafeDeleteAdmin
, like:but this feels pretty messy. Is it possible to change
SafeDeleteAdmin
such that it references some other field on the class like:rather than needing to add an attribute to the method?