Opened 9 years ago
Last modified 9 years ago
#25676 closed Uncategorized
Queryset.extra planned deprecation - Sorting a calculated field — at Version 2
Reported by: | YJD | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.7 |
Severity: | Normal | Keywords: | Queryset.extra |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
After reading that Queryset.extra will be deprecated in the future, I was unable to find alternative methods to sorting on a calculated field. All I'm doing is a simple profit margin calculation, i.e. net income / net sales, and wish to be able to sort that field in a queryset that may or may not be sliced/filtered.
Also, if I wanted to filter, I also had to add
where=['net_income / net_sales >= %s'], params=['0.5']
Change History (2)
comment:1 by , 9 years ago
Keywords: | Queryset.extra added; queryset extra calculated field removed |
---|
comment:2 by , 9 years ago
Description: | modified (diff) |
---|---|
Version: | 1.8 → 1.7 |
Note:
See TracTickets
for help on using tickets.