Opened 7 years ago

Closed 6 years ago

#5708 closed (invalid)

validate() returns 'This field is required.' for number fields if number is Zero

Reported by: florian.leitner@… Owned by: nobody
Component: Core (Other) Version: 0.96
Severity: Keywords: validate zero number
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

in django.db.models.fields.init.py in line 116 change:

if not self.blank and not field_data:

to

if not self.blank and field_data is None:

Change History (2)

comment:1 Changed 7 years ago by mtredinnick

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

Model validation hasn't been fully implemented yet, and that's the only thing that should be calling Field.validate_full() at the moment. This will be fixed at that time.

The suggested fix isn't completely correct, since, for example, an empty string isn't valid there either.

For anybody reading this in the near future, the area that needs changing is Field.validate_full(), which isn't line 116 any longer.

comment:2 Changed 6 years ago by kmtracey

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

This code was removed in [8348]. Can't really call it fixed since #6845 isn't integrated yet, but its patch doesn't appear to have this problem. At any rate the code mentioned here no longer exists so there's nothing to fix for this ticket.

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