Code

Opened 5 years ago

Last modified 17 months ago

#10932 assigned New feature

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

Description

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 5 years ago.
wraps try/except around float(value) on convert_value

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by terrex

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

Changed 5 years ago by terrex

wraps try/except around float(value) on convert_value

comment:2 Changed 5 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 3 years ago by wogan

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

comment:4 Changed 3 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:5 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:7 Changed 17 months ago by akaariai

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from wogan to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.