Opened 2 years ago

Closed 2 years ago

#19997 closed Cleanup/optimization (fixed)

Custom EMPTY_VALUES for form fields.

Reported by: loic84 Owned by: loic84
Component: Forms Version: master
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

Form fields should be able to decide for themselves what value they consider empty rather than through the catch-all validators.EMPTY_VALUES.

An example of this would be a JSONField that considers an empty dict a valid non-empty value.

Model validation had the same issue, and it became problematic when the BinaryField was introduced, this has been addressed in #19989. Form fields would benefit from the same fix.

Attachments (1)

formfields_empty_values.diff (13.6 KB) - added by loic84 2 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 2 years ago by loic84

comment:3 Changed 2 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 4cccb85e292fea01b3459cd97d751ed35179a7b7:

Fixed #19997 -- Added custom EMPTY_VALUES to form fields

Thanks Loic Bistuer for the report and the patch.

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