I'm struggling to get a NullBooleanField to work as radio buttons. By
default, a NullBooleanField (NBF) shows up as a select widget with
options: "Unknown", "Yes", "No".  I assumed I could add this to
"radio_fields" and have it turn those options into radio buttons with
the same labels. But no dice: I get an error that radio_fields only
works with FKs and when choices is set (I think this is an oversight,
as BooleanFields and NullBooleanFields have implicit choices).

Anyway, I wrote my own choices, add 0, 1, and '' blank options to the
field, which works fine, except that Django insists on giving me an
additional blank option "None" when I have blank=True set (which is
required if I want the field to allow saving as None/blank).

Ok, so I consider those two things bugs -- 1) boolean-type fields
should accommodate the RadioSelect widget without extra work and, 2)
given explicit "choices", the field should not add its own
"blank" ("None") option (especially when a blank option is provided in
those choices).

My real question is: how can I change the label of the "None" option?
As it stands, the only way I can get NBF to work as radio buttons is
with the options: "None", "No", "Yes", which is completely ambiguous.
I would like to change "None" to "Hidden" (even "Unknown" -- which is
what's used in the select widget -- would be fine).

Am I overlooking an easy way to change this label? If the answer is to
subclass the RadioSelect widget (presumably to get it to work the way
it already should), could someone help start me with the code, or
point me to a good resource for subclassing widgets?

Thanks!

Josh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to