Django - how to determine if model class is abstract
django, django-models
Solution
You can instantiate MyModel and then check ._meta.abstract.
So in code:
m = MyModel()
print m._meta.abstract
Problem
If a django model is made abstract, like below, is there a way to inspect the class to determine that it is abstract? ``` class MyModel(models.Model): class Meta: abstract = True ``` I would expect that I could examine MyModel.Meta.abstract, but according to Django docs: Django does make one adjustment to the Meta class of an abstract base class: before installing the Meta attribute, it sets abstract=False. This means that children of abstract base classes don't automatically become abstract classes themselves. Any ideas? Thanks!