Skip to content

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

@e-kondr01

Description

@e-kondr01

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions