Opened 4 months ago

Last modified 4 months ago

#28393 new Cleanup/optimization

Add a helpful exception for invalid AutoField/IntegerField values

Reported by: Diederik van der Boor Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description (last modified by Diederik van der Boor)

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 (PR included) displays the field name which makes spotting errors a lot easier.

Pull request: https://github.com/django/django/pull/8760

Change History (2)

comment:1 Changed 4 months ago by Diederik van der Boor

Description: modified (diff)

comment:2 Changed 4 months ago by Tim Graham

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
Note: See TracTickets for help on using tickets.
Back to Top