Closed caesarleong closed 3 years ago
Thank you for reporting this, I think it’s a bug. I think this is the part causing it https://github.com/yezyilomo/django-restql/blob/36f8940e7313d495686c581bbd2b4c4929defa7d/django_restql/mixins.py#L364-L369
Thanks for quick response. Please don't mind me report another issue here which also relate to query kwarg. If I use CourseSerializer without query, it will get exception too because no request.
objs = Course.objects.all()
query = "{name, books{title}}"
serializer = CourseSerializer(objs, many=True)
print(serializer.data)
Thanks for quick response. Please don't mind me report another issue here which also relate to query kwarg. If I use CourseSerializer without query, it will get exception too because no request.
objs = Course.objects.all() query = "{name, books{title}}" serializer = CourseSerializer(objs, many=True) print(serializer.data)
I believe this has been fixed too, The order for finding a query string as of now is https://github.com/yezyilomo/django-restql/blob/0d2d372b7fac225758f4683434d3c279ba62841d/django_restql/mixins.py#L411-L423 You can see that if there’s no query kwarg and request that function returns None, when the value of parsed query is None it means the query has not been passed so all fields are returned. You just have to wait for the new release which is going to be out soon.
Thanks! looking forward the new release!!!
I am using the 0.13.0 new feature "query kwarg" and I found if I follow the document way to use it. It can work perfectly.
But If I modify it with get_serializer(), it will ignored query kwarg and return all field.