1 2 3 | from django.db.models.loading import get_models
for m in get_models():
exec "from %s import %s" % (m.__module__, m.__name__)
|
More like this
- Alternate method of autoloading Django models in ipython by drewr 5 years, 5 months ago
- Quick startup using manage.py shell by dnordberg 5 years, 10 months ago
- cron/console bootstrap django by nstrite 5 years, 10 months ago
- PyCrust Shell by robvdl 5 years, 8 months ago
- A small script to rearranging the models generated from inspectdb command by m_tayseer 4 years, 7 months ago
Comments
I've been dying for a solution to this, thanks!
#
I posted something like this 4 months ago, http://www.djangosnippets.org/snippets/375/
#
http://www.djangosnippets.org/snippets/549/ worked better for me
#