Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#13071 closed (fixed)

NullBooleanField save error in Admin?

Reported by: Ed Hagen Owned by: nobody
Component: Contrib apps Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I have a model field defined thus:

benefit = models.NullBooleanField()

In django 1.1 and 1.2 pre-alpha, nulls were displayed with a "?" icon
in list view. In the Admin change form, a pop-up menu appeared with 3
options (Unknown, Yes, No). Setting to "Unknown" and saving did not
generate any errors.

I then updated to django 1.2 beta 1 SVN-12738. Nulls are now
displayed with "(None)". When I try and set this field to "Unknown"
using the popup menu, and then save in the Admin, I get the following
error:

"This field cannot be blank."

I get this same error when I try and add a new record in the Admin.

I am using python 2.5.1 on Mac OS X and sqlite3.

Attachments (0)

Change History (6)

comment:1 Changed 4 years ago by russellm

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

comment:2 Changed 4 years ago by ubernostrum

(In [12744]) Forced blank=True for NullBooleanField to allow it to pass model validation with a value of None. Refs #13071.

comment:3 Changed 4 years ago by ubernostrum

(In [12745]) Tests for [12744], which were accidentally left out of the commit. Refs #13071.

comment:4 Changed 4 years ago by ubernostrum

(In [12746]) Ensure that NullBooleanField displays the appropriate icon for null values in admin changelists. Refs #13071.

comment:5 Changed 4 years ago by ubernostrum

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

Between those two patches, this should now be fixed.

comment:6 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.