Open mario-maistra opened 2 years ago
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.
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?