[Answer]-Django Queryset only method and foreign keys real fields ('_id')

1👍

only() method loads only the id of model MyModel2.

0👍

Check out using the values_list() method, which can return a list of values if you have only one field you need and you pass it flat = True:

instances = MyModel2.objects.filter(...).values_list('id', flat=True)

Leave a comment