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.BooleanField()

and a script to set initial values:

def fillmembers():

    pad_unreals= 1

    print "ALL: ",MeetingMember.objects.all()

    for x in range(pad_unreals):
        m = MeetingMember()
        m.firstname, m.lastname = 'unsued','unused'
        m.save()
        print "1: ",m.pk,m.active
        m.active = "False"
        print "2: ",m.active
        m.save()
        print "3: ",m.pk,m.active
        print ""

    for x in MeetingMember.objects.all():
        print x.pk,x.active


And the output i get is:


ALL:  []
1:  1 False
2:  False
3:  1 False

1 True


###

!?

This is starting with a freshly synced DB (sqlite)

First, why can i save without specifying active? (also, the CharFields
seem to be empty stings and i can save without specifying them also)

second, after specifying false, saving and verifying that it is false,
when I retrieve it from the DB, I get true!

I can edit it in the admin to false and it stays false,  I can edit it
on the command line and it stays false.  but the script behaves oddly.

please help, and I will learn something important.

-- 
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