[Solved]-Django query to list


Yup, found it: values_list. Here’s the reference: https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list



I am posting the comment by James here to make it more prominent. It was certainly what I was looking for.

I wanted a list of values. Using the QuerySet method .values_list() returned a list of tuples. To get a list of values, I needed the option flat=True.

Record.objects.values_list('fieldB', flat=True) 

Leave a comment