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

后端 未结 6 1110
情话喂你
情话喂你 2021-01-30 12:20

I have a model Employees and I would like to have a QuerySet of all rows, but with some specific fields from each row, and not all fields.

I know how to quer

6条回答
  •  悲&欢浪女
    2021-01-30 12:34

    We can select required fields over values.

    Employee.objects.all().values('eng_name','rank')
    

提交回复
热议问题