On 17/03/2012 11:02am, Ben wrote:
I have a NullBooleanField that I would like to show up in my admin
interface as radio buttons with unknown selected by default.

# I have the following simplified files

## models.py ##
class Value(models.Model):
     presence = models.NullBooleanField(default=False)

Have you tried

    presence = models.NullBooleanField(default=None)


??



## admin.py ##
PRESENCE_CHOICES = ((True, 'True'), (False, 'False'), (None, 'None') )
class ValueAdmin(admin.ModelAdmin):
     formfield_overrides = {
         models.NullBooleanField: {'widget':
RadioSelect(choices=PRESENCE_CHOICES)}
     }
admin.site.register(Value, ValueAdmin)

This behaves very closely to what I desire, but I don't know what I
could replace the False with in:
presence = models.NullBooleanField(default=False)
in order to make it behave as I would like.

Thanks so much for your time,
Ben R.


--
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