> Den 20. maj 2016 kl. 00.12 skrev Larry Martell <larry.mart...@gmail.com>:
> 
> This is probably very simple, but I just can't figure out how to do it.
> 
> I want to get all the columns in some rows as a list. I know I could
> use values_list and flat=True and list all the columns, but is that
> the only way?
> 
> I want to do something like this:
> 
> rows = FOO.objects.filter(bar='baz')
> 
> and get a list of lists instead a list of FOO objects.

"MyModel.objects.filter().values_list()" returns a list of tuples with all 
column values in MyModel._meta.fields order. Does that not suffice?

Erik

-- 
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/DCCE3570-B1B7-4E44-A0B6-1CB0FE8A24BF%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to