views:

43

answers:

1

In django is there way to import all modules

   ex: from project.models import *
   ex: from project1.models import *

Can this be done with one statement

+2  A: 

If you just want to do this when testing things in the shell, look into the shell_plus command provided by the django-extensions project.

This is a really neat extension, which starts a shell and automatically loads all the models in your project when you do ./manage.py shell_plus from the command line.

Daniel Roseman
+1 - Also, you might find the way they load all models instructive (see http://github.com/django-extensions/django-extensions/blob/master/django_extensions/management/commands/shell_plus.py)
Dominic Rodger