views:

78

answers:

1

I have a model which has a required string property like the following:

class Jean(db.Model):
    sex = db.StringProperty(required=True, choices=set(["male", "female"]))

When I try calling Jean.all(), python complains about not having a required property.

Surely there must be a way to get all of them.

If Steve is correct (his answer does make sense). How can I determine if that's actually causing the problem. How do I find out what exactly is in my datastore?

+1  A: 

Maybe you have old data in the datastore with no sex property (added before you specified the required property), then the system complain that there is an entry without sex property.

Try adding a default value:

class Jean(db.Model):
    sex = db.StringProperty(required=True, choices=set(["male", "female"]), default="male")

I hope it helps.

/edit: Go to the local datastore viewer (default is at http://localhost:8080/_ah/admin/) and list your entities. You can try fixing the issue manually (if possible) by filling the missing property.

Steve Gury