Django

Code

Ticket #13071 (closed: fixed)

Opened 5 months ago

Last modified 5 months ago

NullBooleanField save error in Admin?

Reported by: Ed Hagen Assigned to: nobody
Milestone: 1.2 Component: Contrib apps
Version: 1.2-beta Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

Change History

03/09/10 23:41:35 changed by russellm

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

03/10/10 01:41:37 changed by ubernostrum

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

03/10/10 01:42:26 changed by ubernostrum

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

03/10/10 02:37:18 changed by ubernostrum

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

03/10/10 02:37:38 changed by ubernostrum

  • status changed from new to closed.
  • resolution set to fixed.

Between those two patches, this should now be fixed.


Add/Change #13071 (NullBooleanField save error in Admin?)




Change Properties
Action