django get_model returns null when called from __.init__.py? -


from django.db.models import get_model modelname=get_model('base','reports') 

the above code works fine in views.py , django shell,but returns null when called init.py

folder structure shown below

projectsfolder

--base

----models.py

----views.py

---- init.py

that can't possibly work. in __init__.py going executed first time in directory imported. django has import models in order register them, you've got chicken-and-egg situation: won't register them until imports them, you're trying models when they're imported...

can explain though why don't from models import reports?


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -