Opened 2 years ago

Last modified 2 years ago

#33936 closed Bug

BaseModelForm.save() ValueError lacks useful information — at Version 1

Reported by: Josh Moore Owned by: nobody
Component: Forms Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Josh Moore)

We were hitting Airbrake errors in production where the only message provided was "The <model> could not be changed because the data didn't validate." This made it difficult to troubleshoot and debug the problem. The error message would be more useful if it included information about which specific form fields failed to validate and why.

I have prepared a patch which enhances the error message in the BaseModelForm save() method by including the actual form errors in the message, formatted as JSON.

This is my first time contributing to Django and using Trac, please forgive any mistakes I made filling out this form.

PR containing my fix: https://github.com/django/django/pull/15968

Change History (1)

comment:1 by Josh Moore, 2 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top