NilCoalescing / djangochannelsrestframework

A Rest-framework for websockets using Django channels-v4
https://djangochannelsrestframework.readthedocs.io/en/latest/
MIT License
613 stars 86 forks source link

[BUG] #169

Closed bohdanpuzii closed 1 year ago

bohdanpuzii commented 1 year ago

permissions.py

class WSIsAuthenticated(BasePermission):

async def has_permission(self, scope, consumer, action, **kwargs):
    user = scope.get("user")
    if not user:
        return False
    return user.pk and user.is_authenticated

consumers.py

class PostConsumer(GenericAsyncAPIConsumer, ListModelMixin, CreateModelMixin, DeleteModelMixin):

serializer_class = PostSerializer
queryset = Post.objects.all()
permission_classes = WSIsAuthenticated**

when i extend from djangochannelsrestframework.permissions.BasePermission and use it as permission_classes i get a weird error and the error is seems to be an library issue image

bohdanpuzii commented 1 year ago

damn im so stupid