It's a circular import problem. signals.py imports objects from
models.py, and models.py imports objects from signals.py. Python can't
handle circular imports -- hence, the import error.
To fix this, you either need to:
* Put everything in models.py
* Refactor signals.py so that it doesn't need to import models.py at
the global level.
The second approach can be handled in two ways -- either make the
import internal to the 'drink_activity' method:
def drink_activity(sender, **kwargs):
from models import Activity
....
or use Django's dynamic model loading to determine the model at runtime:
from django.db.models import get_model
def drink_activity(sender, **kwargs):
Activity = get_model('myapp','Activity)
...
Django 1.3 will probably introduce a third option -- a reliable place
to register signals. We need this for completely separate reasons, but
providing a safe home for signal registration will be a happy
consequence.
Yours,
Russ Magee %-)