Opened 7 years ago

Closed 19 months ago

#10932 closed New feature (needsinfo)

Allow Min() on CharFields on postgres

Reported by: terrex Owned by: wogan
Component: Database layer (models, ORM) Version: 1.0
Severity: Normal Keywords:
Cc: guillermo.gutierrez@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


Ticket #3566 (features aggregation for ORM) adds method convert_value which fall into "float(value)" and then, does not allow to apply Min, Max, etc, to CharFields. sqlite backend overwrites (in DatabaseOperations) this and returns value instead of float(value), but postgres backend does not overwrite this method.
I'll attach an improvable workaround on this.

Attachments (1)

aggregations_postgresql_allow_charfields.diff (700 bytes) - added by terrex 7 years ago.
wraps try/except around float(value) on convert_value

Download all attachments as: .zip

Change History (9)

comment:1 Changed 7 years ago by terrex

  • Cc guillermo.gutierrez@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set

Changed 7 years ago by terrex

wraps try/except around float(value) on convert_value

comment:2 Changed 7 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

Looks good in principle. However, it needs tests - if only so that it is easy to demonstrate that this approach will work across all supported backends.

comment:3 Changed 6 years ago by wogan

  • Owner set to wogan
  • Status changed from new to assigned

comment:4 Changed 5 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:5 Changed 5 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 5 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:7 Changed 4 years ago by akaariai

  • Component changed from ORM aggregation to Database layer (models, ORM)

comment:8 Changed 19 months ago by timgraham

  • Resolution set to needsinfo
  • Status changed from assigned to closed

I can't tell what this ticket is requesting from its description or its patch. Possibly it is fixed with enhanced expressions support in 1.8. If not, please reopen with more details.

Note: See TracTickets for help on using tickets.
Back to Top