Thanks for the help, all working now! On Sep 22, 11:52 pm, Russell Keith-Magee <russ...@keith-magee.com> wrote: > On Thu, Sep 23, 2010 at 2:41 PM, Joel Klabo <joelkl...@gmail.com> wrote: > > I keep getting this import error and I can't figure out why? Any ideas > > would be greatly appreciated:http://dpaste.org/BgtI/ > > 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 %-)
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.