Get a list of all installed applications in Django and their attributes

Under Django 1.7 and above (thanks Colin Anderson):

from django.apps import apps
apps.get_models()

Under Django 1.6 and below.

If you want all models, try:

from django.db.models import get_models

for model in get_models():
   # Do something with your model here
   print model.__name__, [x.name for x in model._meta.fields]

I believe the older function still works.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)