How to obtain a QuerySet of all rows, with specific fields for each one of them?

Employees.objects.values_list('eng_name', flat=True)

That creates a flat list of all eng_names. If you want more than one field per row, you can’t do a flat list: this will create a list of tuples:

Employees.objects.values_list('eng_name', 'rank')

Leave a Comment