Circular Import in #102

garromark opened this Issue Jul 26, 2012 · 3 comments

2 participants


The get_model() method in is causing a circular import and is raising an exception

AttributeError: 'module' object has no attribute 'settings'

Basically, get_model() is requiring to load, which has the import statement:

from actstream import ... settings as actstream_settings

So you have actstream.settings importing actstream.models trying to import actstream.settings. I'm not really sure you're going to get around this while keeping get_model() in I'm really interested in what you can do as a fix for this.


get_model should not be requiring actstream.models to load. what settings are you using?


Taking a look at AppCache._populate() in from which get_model() is loaded in Django 1.4, I notice that the app_names are loaded from settings.INSTALLED_APPS. I have "actstream" in my INSTALLED_APPS, so it's loading from actstream.


fixed in master by adding settings.get_models which returns the model lookup when called instead of imported. expect this change in v0.4.4

one caveat to your suggestions is that the reverse lookup can contain any actionable model not just users. to get just users, call something like following(request.user, User)

@justquick justquick closed this Jul 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment