Skip to content
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

RealtimeMixin's from_scope() doesn't set request's user on djangorestframework==3.13.1 #23

Open
e-kondr01 opened this issue Sep 19, 2022 · 0 comments

Comments

@e-kondr01
Copy link

Some backgound: I was trying to figure out why my view's queryset doesn't get filtered by user.
I found out that after this line:

view = self.registry[model_label].from_scope(

view.request.user is AnonymousUser, but self.scope.get("user") is the correct user.
When I changed this line:
https://github.com/pennlabs/django-rest-live/blob/master/rest_live/mixins.py#L84
to:
base_request._user = scope.get("user", None)
the bug was gone.
This was the line that made me try the change above:
https://github.com/encode/django-rest-framework/blob/master/rest_framework/request.py#L225
My PR:
#22

@e-kondr01 e-kondr01 changed the title RealtimeMixin's from_scope doesn't set user on djangorestframework==3.13.1 RealtimeMixin's from_scope doesn't set request's user on djangorestframework==3.13.1 Sep 19, 2022
@e-kondr01 e-kondr01 changed the title RealtimeMixin's from_scope doesn't set request's user on djangorestframework==3.13.1 RealtimeMixin's from_scope() doesn't set request's user on djangorestframework==3.13.1 Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant