12👍
✅
Yup, found it: values_list
. Here’s the reference: https://docs.djangoproject.com/en/dev/ref/models/querysets/#values-list
👤JPC
9👍
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)
- How do I check that user already authenticated from tastypie?
- Django: what's the difference between a temporary redirect and a permanent redirect?
- How to add filters to a query dynamically in Django?
- Is there a Django ModelField that allows for multiple choices, aside from ManyToMany?
- Django Testing: Does –keepdb reset changes made during tests?
Source:stackexchange.com