#14243 closed (invalid)
defer and only are not respected by values and by valuest_list()
| Reported by: | pma_ | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.2 |
| Severity: | Keywords: | defer only values | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
data model with 2 field owner and category
run query like
result = CatalogCategories.objects.only('id', 'category').values() #or values_list()
you always will get full record
Change History (2)
comment:1 by , 15 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:2 by , 15 years ago
Just to clarify what agabel said: defer and only are about which attributes of an model instance are lazily loaded. values returns something entirely different, so it wouldn't make sense for it to be affected.
Note:
See TracTickets
for help on using tickets.
This usage is incorrect. To limit the fields returned by values() they must be added as arguments. (ex. CatalogCategories.objects.values('id', 'category') ) Since you have not specified any fields, they will all be returned.
Documentation can be found at http://docs.djangoproject.com/en/dev/ref/models/querysets/#values-fields
I'm changing this ticket to invalid.