Opened 7 years ago

Closed 5 years ago

#28393 closed Cleanup/optimization (fixed)

Add a helpful exception for invalid values passed to AutoField/FloatField/IntegerField.

Reported by: Diederik van der Boor Owned by: Nick Pope
Component: Database layer (models, ORM) Version: dev
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 (last modified by Nick Pope)

When a large model is updated and saved with invalid values,
Django produces a traceback deep within the ORM, with no clue
which field assignment caused the error.

Developers are faced with:

"TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'"

This change displays the field name which makes spotting errors a lot easier.

Change History (4)

comment:1 by Diederik van der Boor, 7 years ago

Description: modified (diff)

comment:2 by Tim Graham, 7 years ago

Easy pickings: unset
Patch needs improvement: set
Summary: Make debugging of invalid values assignments to model fields easierAdd a helpful exception for invalid AutoField/IntegerField values
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

comment:3 by Nick Pope, 5 years ago

Description: modified (diff)
Owner: changed from nobody to Nick Pope
Patch needs improvement: unset
Status: newassigned
Summary: Add a helpful exception for invalid AutoField/IntegerField valuesAdd a helpful exception for invalid values passed to AutoField/FloatField/IntegerField.
Version: 1.11master

New PR.

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

Resolution: fixed
Status: assignedclosed

In 25f21bd2:

Fixed #28393 -- Added helpful error messages for invalid AutoField/FloatField/IntegerField values.

Co-authored-by: Diederik van der Boor <vdboor@…>
Co-authored-by: Nick Pope <nick.pope@…>

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