"Not specified" states for BooleanField
|Reported by:||Valera Grishin||Owned by:||nobody|
|Severity:||Keywords:||BooleanField NullBooleanField nfa-fixed|
|Cc:||Triage Stage:||Fixed on a branch|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
BooleanField needs additional states "Not specified" which means that field wasn't supplied by user when editing ForeignKey'ed model with core=True
Following is an intentionally simplified (for the purpose of demonstration) version of models I need to use in my project:
!#python class DataClass(models.Model): name = models.CharField(max_length=100) class Admin: pass class BooleanAttribute(models.Model): owner = models.ForeignKey(to=DataClass, core=True, edit_inline=models.TABULAR) class Admin: min_num_in_admin = 3
When editing the DataClass model via Django's default admin interface it will (of course) display 3 (according to min_num_in_admin) BooleanAttibute models too. Submitting the form will cause all three BooleanAttributes to be added to the newly created DataClass instance. And there is no way to say how many of them really need to be saved.
My proposition is too enhance BooleanField with optional second checkbox that will indicate whether value is given or not. And only if it is on then the actual value of BooleanField to be considered.
I'd like to provide patch for this issue but have no idea of where to look at. Any help - hints, suggestions, etc - will be greatly appriciated.
Change History (5)
comment:2 Changed 9 years ago by
|Status:||closed → reopened|
comment:4 Changed 9 years ago by
|Triage Stage:||Unreviewed → Fixed on a branch|