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

Querying data not working as expected #297

Open
mario-maistra opened this issue Dec 16, 2021 · 1 comment
Open

Querying data not working as expected #297

mario-maistra opened this issue Dec 16, 2021 · 1 comment

Comments

@mario-maistra
Copy link

mario-maistra commented Dec 16, 2021

While trying out querying data on the playground, I could not get the excepted result. For example, I chose Course model on the playground and tried to query by book ID, like this:
{ id, name, code, books(id:3) { id, title, author, genre { id, title, description } } }

It returns all courses. But if I try to query by course id, like this:
(id:1) { id, name, code, books { id, title, author, genre { id, title, description } } }

It works as excepted. Tried it out on some of the offered models, but I could not get consistent result...sometimes it works as excepted, and in some cases (like this one) it does not. How does this exactly work?

@resurrexi
Copy link
Contributor

resurrexi commented Jan 7, 2022

The behavior in the first query happens because books is a many-to-many field. However, it's quite unlikely that the issue lies with django-restql as django-restql simply propagates the filtering responsibility to the django filtering backend. It would depend on how the the filters for the many-to-many field were defined (if any) and which backend was used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants