Reputation: 111
I am trying to run a Django project, I tried to import assign_perm
and remove_perm
from guardian.shortcuts
(code listed here: from guardian.shortcuts import assign_perm, remove_perm
).
and got an error:
ModuleNotFoundError: No module named 'guardian.shortcuts'
I am using python3.8.9 and django2.0.7. I have already successfully tried install guardian(0.2.2) and Django-guardian(2.4.0), and I can import guardian successfully directly. Please help me to figure it out. THX!
P.S. I tried to print(guardian.__file__)
and the output is here:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/guardian/__init__.py
Upvotes: 0
Views: 213
Reputation: 111
emmmm actually I don't know why, I just use pip3
to uninstall guardian
and Django-guardian
, and reinstall Django-guardian
and it worked. and I found that both assign_perm
and assign
is available for Django-guardian2.4.0
, but only remove_perm
(rather than remove
) is available for this version. If you struggled with this issue and following solutions above still cannot help you can have a try for my solution. Hope this can help you.
Upvotes: 0