views:

31

answers:

1

I have such file order:

project/
    app/
        models.py
        signals.py

I am keeping signals inside signals.py as it should be. and at the top of the signals.py file, I include myapp models as I do queries in these signals with

from myproject.myapp.models import Foo

However it doesnt seem to find it, as I run the server or validate from manage.py, it gives this error:

   from myproject.myapp.models import Foo
ImportError: cannot import name Foo

I am using Django 1.2.1.

+1  A: 

Most likely you have a circular dependency. Does your models.py import the signals? If so, this can't work as both modules now depend on each other. You may need to import the models within a function in the signals file, rather than at the top level.

Daniel Roseman
thanks alot Daniel! Putting import inside the signal solved the issue :)
Hellnar