Opened 19 years ago
Closed 19 years ago
#1152 closed defect (invalid)
distinct keyword in model seems not working
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | 0.90 |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
How to limit records with "distinct" keywords if every model seems to return all fields (together with primary key)? SELECT DISTINCT field1,field2 ... has sense only when primary key is not included in the field list. I checked the code and I could see Django always uses fields defined in model class + primary key...
Note:
See TracTickets
for help on using tickets.
See http://www.djangoproject.com/documentation/db_api/#limiting-selected-rows