In Django, is there a place I can get a list of or look up the models that the ORM knows about?
Simple solution:
import django.apps
django.apps.apps.get_models()
By default apps.get_models()
don't include
If you want to include these as well,
django.apps.apps.get_models(include_auto_created=True, include_swapped=True)
Prior to Django 1.7, instead use:
from django.db import models
models.get_models(include_auto_created=True)
The include_auto_created
parameter ensures that through tables implicitly created by ManyToManyField
s will be retrieved as well.