Opened 6 years ago

Closed 6 years ago

#32585 closed Bug (fixed)

Value() with DecimalField crashes on SQLite.

Reported by: Adrian Garcia Owned by: Hasan Ramezani
Component: Database layer (models, ORM) Version: 3.1
Severity: Normal Keywords: SQLite3, annotate, decimal
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

If you try to annotate anything to a decimal field Django will pass a string to create_decimal_from_float function.

​These are the offending lines

example code:

SomeModel.objects.all().annotate(shear_length=Value(1, output_field=DecimalField()))

Change History (5)

comment:1 by Adrian Garcia, 6 years ago

comment:2 by Mariusz Felisiak, 6 years ago

Has patch: set
Needs tests: set
Patch needs improvement: set
Summary: Type Error when annotating a decimal to decimal field with SQLite3 → Value() with DecimalField crashes on SQLite.
Triage Stage: Unreviewed → Accepted

Thanks for the report, we should make Value inherit from SQLiteNumericMixin.

comment:3 by Mariusz Felisiak, 6 years ago

Has patch: unset
Needs tests: unset
Patch needs improvement: unset

comment:4 by Hasan Ramezani, 6 years ago

Has patch: set
Owner: changed from nobody to Hasan Ramezani
Status: new → assigned

New ​PR

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 6 years ago

Resolution: → fixed
Status: assigned → closed

In ed0cc52d:

Fixed #32585 -- Fixed Value() crash with DecimalField on SQLite.

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