[Answered ]-Django queryset: equivalent of SELECT all fields from two joined models

2👍

You can do this using values()

results = Person.objects.values('name', 'skills__skill')
for result in results:
    print(result['name'], result['skills__skill'])

In this case it’s straight forward because the number of fields is small. If there were more fields, then either the code would get very long, or you would need to introspect the field names somehow.

Leave a comment