Import Error when trying to use set up a custom manager
See original GitHub issueI’ve written a custom manager, but can’t use it due to an import error in settings.py
. The error is:
ImportError: Cannot import social.managers.MyActionManager try fixing ACTSTREAM_SETTINGS[MANAGER]setting.
These are the settings:
ACTSTREAM_SETTINGS = {
'MANAGER': 'social.managers.MyActionManager',
'FETCH_RELATIONS': True,
'USE_JSONFIELD': True
}
And this is the social.managers
file:
from datetime import datetime, timedelta
from actstream.managers import ActionManager, stream
from actstream.models import following, user_stream
class MyActionManager(ActionManager):
@stream
def any_followed_stream(self, user, **kwargs):
date_start = datetime.now() - timedelta(days=3)
return user_stream(user).filter(date__gte=date_start)
The path is definitely correctly, so not sure what’s wrong here?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Custom Django Model Managers giving error when trying to ...
I'm trying to use custom manager methods so eventually I can pass in arguments for additional filtering where needed.
Read more >Cannot import custom objects even with the permission 'Import ...
1. Go to Setup | Object Manager | Create | Custom Object · 2. Fill-out all the necessary fields and configurations for the...
Read more >The specified module 'Module Name' was not loaded because ...
Problem: When trying to import the PnP PowerShell module, I got an error message ... To fix the issue, You have to make...
Read more >2088177 - What is "Custom Manager" in the application?
Custom Manager is a data field that you can add to your Employee Import File. Example. CUSTOM_MANAGER, MATRIX_MANAGER. Custom Manager (HR), Matrix Manager...
Read more >Fix Custom Inventory Errors SCCM Hardware Inventory MOF ...
Error. You can only import hardware inventory classes for the default client settings on the central administration site. The following Classes ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
it looks like your hitting a cyclical import error when importing from
actstream.models
in your manager. try moving the import statements into the stream methods like soIm having the same problem, Would anyone helo me?