Saturday, April 27, 2013

Re: Django Admin - BooleanField issue

Hi. May be you need

active = models.BooleanField(choices=((True,'yes'),(False,'no')))

?

- With regards, Andrei


2013/4/27 Marc R <warath@gmail.com>
I've setup a boolean field and get it to display correctly using this in my model:
active = models.BooleanField(choices=((1,'yes'),(0,'no')))

However, when I edit a record in the Django Admin, the select field always shows "yes" regardless of the database value.

Saving "yes" or "no" stores the correct 1 or 0; is there a bug in the edit form?  Or did I miss a setting?

Thanks,

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment