Well, both Django and Python are consistent in their use of the terms 
"True" and "False" to represent boolean objects:

https://docs.djangoproject.com/en/dev/ref/models/fields/#booleanfield
http://docs.python.org/2/library/stdtypes.html#boolean-values

In addition, the whole point of the ORM is to shield you from *how* a 
database stores a particular value (be it boolean or anything), and just 
work with it as though it was a POPO (Plain Old Python Object). 

On Saturday, 27 April 2013 22:45:00 UTC+2, Marc R wrote:
>
> That seems to have worked... I used 1 and 0 as the database is set for a 
> tinyint to store the value (so needs to be 1 or 0).  That said, 
> django/python seems to figure that out when saving the value.
>
> Thanks; wouldn't have thought to try that.
>
> On Saturday, 27 April 2013 14:46:14 UTC-4, Andrew Boltachev wrote:
>>
>> Hi. May be you need
>>
>> active = models.BooleanField(choices=((True,'yes'),(False,'no')))
>>
>> ?
>>
>> - With regards, Andrei
>>
>>
>> 2013/4/27 Marc R <war...@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...@googlegroups.com.
>>> To post to this group, send email to django...@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+unsubscr...@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.


Reply via email to