-
Notifications
You must be signed in to change notification settings - Fork 58
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
has_object_read_permission does not work with queryset.values('fields') #26
Comments
Hi Divick, Can you post your View, Serializer, Model? It may help me get a better understanding of what is going wrong. |
As my understanding goes, Django returns a dictionary instead of Model values() and values_list() are both intended as optimizations for a I'm not very sure how to optimise the database fetching in your case, but On Saturday, 9 July 2016, David Kaplan [email protected] wrote:
|
Hi David, @andhieka has rightly pointed out though why the issue is there as values/values_list return a dictionary instead of object. But I was unable to find a solution to this problem where I want to just load individual fields instead of looking up all 60+ fields. My ViewSet class:
My Serializer class:
My model class (not showing all fields as there are around 60 of them and I have simplified my permissions for the sake of clarity.
|
In my get_queryset I return a query set so that only required fields are returned instead of looking up all the fields as I have around 60 columns in my table for the model. With this, the DRYRestPermission throws assertion error.
My get_queryset method looks something like this:
The text was updated successfully, but these errors were encountered: