Opened 4 years ago
Closed 4 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 , 4 years ago
comment:2 by , 4 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 , 4 years ago
Has patch: | unset |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
Note:
See TracTickets
for help on using tickets.
Submitted a pull to fix it: https://github.com/django/django/pull/14168