In Django, you can pass the field names you want to select as arguments to the values()
method to select only particular fields.
Person.objects.all().values('first_name')
As only one argument was passed in the method, only the first_name
has been retrieved from the database.
Similarly, multiple arguments can be passed and those columns alone would be retreieved from the database.
Person.objects.all().values('first_name', 'birth_date')
This is particularly useful when you want to optimize database queries by fetching only the data you need, which can lead to improved performance in your Django applications.