In admin, inlines should be allowed to be properties
|Reported by:||mariarchi||Owned by:||nobody|
|Severity:||Normal||Keywords:||admin inlines duck typing|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently, if admin class defines an attribute 'inlines' which is not an instance of tuple or a list, django will raise an error.
I believe that this is wrong and contradicts the duck typing philosophy - we shouldn't care that the attribute 'inlines' is an instance of list/tuple, but rather we should care that it is iterable.
The reason why I believe that behavior is wrong is the following:
one might want to define 'inlines' as a property. This might happen when admin class A inherits from admin class B, and class B adds some inlines (that can be useful when developing a pluggable application). If class A has some inlines of its own, it can be useful to declare inlines as a property and then call 'super' to retrieve the inlines of class B.
Change History (6)
comment:1 Changed 6 years ago by mariarchi
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 6 years ago by russellm
- Component changed from Contrib apps to django.contrib.admin