Opened 18 years ago
Closed 18 years ago
#4810 closed (fixed)
[newforms-admin] Bad check for model classes in AdminSite
Description ¶
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)
by , 18 years ago
comment:1 by , 18 years ago
Has patch: | set |
---|
comment:2 by , 18 years ago
Version: | SVN → newforms-admin |
---|
comment:3 by , 18 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:4 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Patch implementing the check with isinstance() instead of issubclass()