> > Take a look at `values_list` too.
https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list <https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list> Em quinta-feira, 15 de junho de 2017 12:51:56 UTC-3, Todor Velichkov escreveu: > > That's it, I want to get a list of all fields which are going to be > selected by a queryset, is it possible? > > e.g. > > qs = MyModel.objects.only('id', 'name') > select = qs.query.select #should be ['id','name'] > > PS. I notice there is a `qs.query.select`, but its empty. No idea if its > the same as what I'm looking for, and how to use/fill it. > PS2. The method should return all fields, i.e. annotations too (if there > are any). > > > > > Em quinta-feira, 15 de junho de 2017 12:51:56 UTC-3, Todor Velichkov escreveu: > > That's it, I want to get a list of all fields which are going to be > selected by a queryset, is it possible? > > e.g. > > qs = MyModel.objects.only('id', 'name') > select = qs.query.select #should be ['id','name'] > > PS. I notice there is a `qs.query.select`, but its empty. No idea if its > the same as what I'm looking for, and how to use/fill it. > PS2. The method should return all fields, i.e. annotations too (if there > are any). > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5896911f-2595-48da-9a81-99a899b9f14a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.