[newforms-admin] Bad check for model classes in AdminSite
|Reported by:||ubernostrum||Owned by:||adrian|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
AdminSite.register and AdminSite.unregister both are meant to accept either a model class or a list of model classes, and differentiate the two by checking issubclass(model_or_iterable, Model), but this will blow up on a list -- the first argument to issubclass must be a class.
One alternative might be to import django.db.models.base.ModelBase and use isinstance(model_or_iterable, ModelBase).
Change History (5)
Changed 7 years ago by ubernostrum
comment:1 Changed 7 years ago by ubernostrum
- Has patch set
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:3 Changed 7 years ago by Simon G. <dev@…>
- Triage Stage changed from Unreviewed to Ready for checkin