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 object from the database
>>> x = SomeModel.objects.get(pk = 1)

#it's currently False
>>> x.some_bool
False

#assign some junk that's not True or False
>>> x.some_bool = 'apple'

#yep, still there...
x.some_bool
>>> 'apple'

#this just saved True in the database
#because 'apple' evaluates to True.
>>> x.save()

#but my in-memory instance still contains 'apple'
>>> x.some_bool
'apple'

#until I go get it from the database again.
>>> x = SomeModel.objects.get(pk = 1)

>>> x.some_bool
True


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

Reply via email to