On Thu, May 15, 2008 at 1:59 PM, Szaijan <[EMAIL PROTECTED]> wrote: > Hi, I developed my first Django app on my Macbook Pro using PostgreSQL > and > have recently moved it to a production site which uses MySQL. > PostgreSQL stores boolean values as True and False, just like Python > and JS, while MySQL uses 1 and 0. > > Is there some automated way to get the models to understand this and > present/save boolean values to and from views, or do I need to > override the save and get methods so that they translate 0 to False, 1 > to True, and vice versa? This seems to be a barrier to portability if > I have to hard code DB awareness into my models. >
You don't need to do anything, the right thing will just happen. Your Python/Django code deals with boolean fields and doesn't need to know anything about the details of how MySQL stores them. (Unless you use raw sql, in which case you might have to care.) 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 -~----------~----~----~----~------~----~------~--~---

