New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise error when user object is not found. #3312
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3312 +/- ##
===========================================
- Coverage 67.32% 66.44% -0.88%
===========================================
Files 375 375
Lines 25472 24648 -824
Branches 939 939
===========================================
- Hits 17149 16378 -771
+ Misses 8323 8270 -53
Continue to review full report at Codecov.
|
Thanks, missing AnonymousUser appears to be the root cause. That was addressed in #1103, so I'll reopen it and move it to the Next milestone. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one additional item.
@@ -1,4 +1,5 @@ | |||
from django.contrib.auth.models import User | |||
from django.http import Http404 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, replace the line above with:
from guardian.compat import get_user_model
then:
User = get_user_model()
as described here: https://django-guardian.readthedocs.io/en/latest/configuration.html
Resolves #3175
Notes from issue
"Once project is configured to work with django-guardian, calling syncdb management command would create User instance for anonymous user support (with name of AnonymousUser)." https://django-guardian.readthedocs.io/en/stable/configuration.html?highlight=anon