Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#11860 closed (fixed)

Changing a NullBooleanField from "unknown" to "no" in the admin does not save

Reported by: gregplaysguitar Owned by: matiasb
Component: contrib.admin Version: 1.1
Severity: Keywords: nullboolean dirty
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

This only occurs if the nullboolean is the only thing changed - if I change another field in the form at the same time, it works.

I'm assuming that the problem is that the form isn't being marked as dirty by the nullbooleanfield when it should be.

Attachments (1)

nullbooleanselect_patch.diff (1.5 KB) - added by matiasb 4 years ago.
Fixed _has_changed method of NullBooleanSelect widget to distinguish between None and False (updated)

Download all attachments as: .zip

Change History (11)

comment:1 Changed 5 years ago by gregplaysguitar

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Note - this only occurs when the model is registered in an admin inline.

comment:2 Changed 4 years ago by russellm

  • milestone set to 1.2
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 4 years ago by russellm

  • Component changed from Uncategorized to django.contrib.admin

comment:4 Changed 4 years ago by matiasb

  • Owner changed from nobody to matiasb
  • Status changed from new to assigned

comment:5 Changed 4 years ago by matiasb

  • Has patch set

added patch

Changed 4 years ago by matiasb

Fixed _has_changed method of NullBooleanSelect widget to distinguish between None and False (updated)

comment:6 Changed 4 years ago by Alex

  • Triage Stage changed from Accepted to Ready for checkin

comment:7 Changed 4 years ago by anonymous

One issue with the test might be that the test still passes after if I uncomment all the lines of the _has_changed method except the return initial != data line.

comment:8 Changed 4 years ago by jkocherhans

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

(In [12523]) Fixed #11860. Changed NullBooleanSelect's _has_changed method to repect differences between None and False. Thanks, matiasb.

comment:9 Changed 4 years ago by jkocherhans

(In [12524]) [1.1.X] Fixed #11860. Changed NullBooleanSelect's _has_changed method to repect differences between None and False. Backport of [12523] from trunk.

comment:10 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.