Giter Club home page Giter Club logo

django-rest-live's People

Contributors

armaant avatar davish avatar jerivas avatar kevc528 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-rest-live's Issues

Cant make it work

Hi! I just wanna tell you that there is no way to make it work in my enviroment, i just tried a lot of different things:

This is my requirements.txt:

channels-redis==2.4.2
channels==2.2
daphne
django==3.1.4
django-extensions
django-rest-live
psycopg2
djangorestframework-camel-case

I have set up and followed every step and connected via websockets but i dont receive any update in my model. If you can give a little help or at least upload another example to check with mine it would be great!

Thanks a lot for your work with this package.

Regards

Alejandro

Issues with subscription.

I keep getting

>>> TypeError: __call__() missing 1 required positional argument: 'send'
>>> WebSocket DISCONNECT /ws/products/ [127.0.0.1:59261]

Meanwhile, there is no way for me to access the consumer class and be able to specify what should be sent back to clients.
Also, the documentation doesn't give any good example of subscribing, it just provides a JSON object without specifying where the object should be injected or how it should be done, I've scanned through the whole internet, but I couldn't find an example app, how do I fix an error when I can't even get anything.

Using with lastest Channel version

I get this error, trying to use the plugin with Channels 3.0.4

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behavior is the source of the following dependency conflicts.
django-rest-live 0.4.4 requires channels<3,>=2.0.0, but you have channels 3.0.4 which is incompatible.

[Hacktoberfest - Labs Members] Add Python Docstrings

Django REST Live is an open source framework developed by Labs to add support for real-time subscriptions over websockets to Django REST Live. This is especially useful for OHQ!

It would be great for more Labs members to understand how REST Live works. The main goal for this task is to learn about the internals of REST Live. Be sure to think about what each function does in REST Live and when they are invoked.

Additionally, try to add some descriptive docstrings to methods in REST Live to make it easier for others to learn how REST Live works. For docstrings, I recommend using Google style docstrings, though any consistent style of docstring is fine.

lookup_by doesn't seem to be properly filtering

This subscription

{
    id: new Date().getTime(),
    type: "subscribe",
    model: "app.MyModel",
    action: "retrieve",
    lookup_by: 1,
}

returns changes made to any instance of MyModel.

I stepped through the code.

view.get_object()

does indeed return the correct object.

It seems to me that the issue is here:

instance = view.filter_queryset(view.get_queryset()).get(pk=instance_pk)

This should make sure that instance_pk == subscription.view_kwargs['pk'] or similar (ie the instance that triggered the event is the same instance that is subscribed to).

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.