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

lookup_by doesn't seem to be properly filtering #20

Open
mustafa0x opened this issue Mar 8, 2022 · 1 comment
Open

lookup_by doesn't seem to be properly filtering #20

mustafa0x opened this issue Mar 8, 2022 · 1 comment

Comments

@mustafa0x
Copy link

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).

@mustafa0x
Copy link
Author

On a related note: I understood from the docs that action: "list", view_kwargs: {key: val}, would behave like .filter(key=val), but it too is returning instances that don't match that filter.

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