Hello,

Django can’t do this out of the box, but see this post[1] for a possible
solution with dicts.

You might also want to look at serialization[2]; it might help you a bit,
but again, it’s primarily for dicts, not lists.

On the other hand, I started wondering why you need this, do you care to
share the use case?

Cheers,
Gergely

[1] http://stackoverflow.com/a/29088221/1305139
[2] https://docs.djangoproject.com/en/1.9/topics/serialization/
On May 20, 2016 00:13, "Larry Martell" <larry.mart...@gmail.com> wrote:

> 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.
>
> --
> 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/CACwCsY7EZtbmLqLgggZnnBspKbvOucPDki1i28zD3jtjGp%3DWFQ%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CACczBUJBs87C9ayBxEyfWo4AX%2BFrB0Do%2BrNeNTtX7OKQyoxr%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to