Michael, this will not work for cases with `values` and `annotations` On Sunday, July 5, 2020 at 2:23:03 PM UTC-4, michaelfladischer wrote: > > What about introspecting the model associated with the QuerySet: > > qs = SomeModel.objects.all() > columns = [f.column for f in qs.model._meta.fields] > > Regards, Michael > > > Am 04.07.2020 um 22:11 schrieb Eugene Kulak: > > How to get names of columns from QuerySet without executing it? > > If it is not possible what would be the most easier way to execute a > > lighter version of the query. > > The query itself is unknown, it could be anything. >
-- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5d260888-c607-4121-81b2-a18215d38f8do%40googlegroups.com.