Re: Boolean field, unexpected behavior

2011-06-09 Thread Malcolm Box
On 9 June 2011 21:16, elliot wrote: > However, I'm still not clear why i can save without specifying values > for the CharField or BooleanField. I didn't say null="true", and I > didn't provide default values. > > Because both have sensible default values ("" for CharField, False for BooleanFiel

Re: Boolean field, unexpected behavior

2011-06-09 Thread elliot
Thanks, Your email wasn't showing up when I sent the second one. Little bit of lag i guess. What a noob mistake, thanks for the clarification. I did originally have a default in my model instance, but i deleted it as part of the debugging. However, I'm still not clear why i can save without sp

Re: Boolean field, unexpected behavior

2011-06-09 Thread Shawn Milochik
On 06/09/2011 03:42 PM, elliot wrote: to my great annoyance, not specifying active has lead to the objects being created as I wanted. But I cannot rely on this. Seems like m.active is true if either true or false is specified, and is false if it is never initialized. See my previous e-mail. I

Re: Boolean field, unexpected behavior

2011-06-09 Thread elliot
to my great annoyance, not specifying active has lead to the objects being created as I wanted. But I cannot rely on this. Seems like m.active is true if either true or false is specified, and is false if it is never initialized. On Jun 9, 2:24 pm, elliot wrote: > I am not new to django, but th

Re: Boolean field, unexpected behavior

2011-06-09 Thread Shawn Milochik
You have two problems: 1. You're assigning a string to a boolean. The string will evaluate to true. 2. You're not re-querying the database after the first save, so your 'm' instance still retains the string 'False.' Here's some sample output with commentary which will illustrate. #get an obj

Boolean field, unexpected behavior

2011-06-09 Thread elliot
I am not new to django, but this misbehavior is blowing my mind. I cannot understand what is happening. please help. Django 1.1 I have: class MeetingMember(models.Model): lastname = models.CharField(max_length = 30) firstname = models.CharField(max_length = 30) active = models.Boole