Autoload Django Models When Using ./manage.py shell

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

  1. Simple Plone Migration by msm-art 6 years, 3 months ago
  2. Quick startup using manage.py shell by dnordberg 6 years, 8 months ago
  3. cron/console bootstrap django by nstrite 6 years, 8 months ago
  4. PyCrust Shell by robvdl 6 years, 5 months ago
  5. Alternate method of autoloading Django models in ipython by drewr 6 years, 3 months ago

Comments

udfalkso (on January 10, 2008):

I've been dying for a solution to this, thanks!

#

(Forgotten your password?)