How do I list all classes of a given type in a python file?
Posted
by Hobhouse
on Stack Overflow
See other posts from Stack Overflow
or by Hobhouse
Published on 2010-04-29T09:17:12Z
Indexed on
2010/04/29
9:27 UTC
Read the original article
Hit count: 335
I use django, and have a lengthy models.py file.
class Foo(models.Model):
name = models.CharField()
class Bar(models.Model):
name = models.CharField()
class Fab(models.Model):
name = models.CharField()
Is there a way to make a list of all the classes in the file which are an instance of (models.Model)?
© Stack Overflow or respective owner