AttributeError: 'NoneType' object has no attribute 'is_superuser' #8142
Unanswered
dalmia
asked this question in
Potential Issue
Replies: 1 comment
-
Might be missing or failing to run the middleware to populate |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone,
Thank you so much for the amazing work done by all the contributors. I am very grateful for your work.
We've been using DRF for managing our APIs and while everything seems to be working fine on production, we are constantly seeing this error in the production logs:
A bit about the structure of the app:
We have a model for users (
User
), organizations (Organization
) and organization users (OrganizationUser
). TheUser
model contains a field calledorganizations
which gets auto-populated based on the entries in theOrganizationUser
table (many-to-many relationship).The line mentioned above in the logs appears in the
OrganizationUserViewSet
as shown below:You can even check out the complete code here.
No other part of the codebase is supposed to be invoking the
OrganizationUserViewset
apart from the many-to-many relationship mapping in theUser
model mentioned above.What do you think could be causing the
request.user
object to be returned asNone
?Beta Was this translation helpful? Give feedback.
All reactions