#31663 closed Bug (fixed)
DecimalField.to_python() raises TypeError on dict values.
| Reported by: | Sasha Pachev | Owned by: | Sasha Pachev |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 3.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
A call to DecimalField.to_python() with a dictionary as the value parameter produces TypeError instead of ValidationError. This is a problem, for example, when you try to save a model object, and a decimal field got set to a dictionary by mistake. The TypeError exception that comes back makes it hard to track the problem to the field if the object has a lot of fields.
I am proposing a patch to fix it:
Change History (3)
comment:1 by , 5 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
| Summary: | A call to DecimalField.to_python() with a dictionary as the value parameter produces TypeError instead of ValidationError → DecimalField.to_python() raises TypeError on dict values. |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Uncategorized → Bug |
| Version: | 3.0 → 3.1 |
comment:2 by , 5 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
In 38a21f2d: