[Django]-Django Queryset only

3👍

only() specifies which fields should be populated from the database, but it does not prevent other fields on the model from being accessed. If you want to limit the fields available in the resultant objects then you should use values() or values_list() instead. Note that neither of them returns models, since using a model would still make the other fields available.

Leave a comment