On Thu, May 15, 2008 at 7:04 PM, Szaijan <[EMAIL PROTECTED]> wrote:

>
> I see it in my views.  When I return the set and saved values for a
> model, I get True or False from my app on the MacBook (Postgres) and 1
> or 0 from the exact same code on my Slicehost site (MySQL.)
>
> So, if I add something like:
>
> m = Model.objects.get(id=id)
> print m.boolean_field_name
>
> I get True/False on my MacBook and 1/0 on my Slicehost site.  I have
> also confirmed this in python manage.py shell.
>
> >>> from visionary.harp.models import Combatant_Template
> >>> ct = Combatant_Template.objects.all()
> >>> ct[0]
> <Combatant_Template: Orc (  L0)>
> >>> ct[0].party <--- A BooleanField
> 0 <-- result on Slicehost site using MySQL
>
> >>> ct[0].party <--- A BooleanField
> True <-- result on MacBook Pro using PostgreSQL
>
> Perhaps there's a setting I need that is missing?
>

Hmm, that's interesting, and I never noticed it.  I guess I haven't
interrogated values directly like that.  That does seem odd, I'd expect a
boolean field to be returning a boolean value. But in Python 1 == True
evaluates to True and 0 == False evaluates to True, so your code doesn't
really need to care one way or the other what is returned, does it?

I also see on further looking around that there is a ticket open on this:

http://code.djangoproject.com/ticket/7190

Also note you don't have to supply 0/1 when querying. You can filter values,
e.g. on True/False and that works properly.

Karen

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

Reply via email to