views:

33

answers:

1

Is it possiible to change attribute name on db.Model kind? i have some field name created with dash (e.g. field-name) that resulting error.

class DataBulk(db.Model):
    group_id = db.IntegerProperty()
    group_name = db.StringProperty()
    geo_pos = db.GeoPtProperty()
    group-leader = db.StringProperty() <-----------error 
    imported = db.IntegerProperty(default=0)

Anyone can tell me what's wrong?

+2  A: 

You must use valid Python names to define properties like that. Strictly speaking you can define the name that is stored in datastore, passing an argument "name" to the property:

class DataBulk(db.Model):
    group_id = db.IntegerProperty()
    group_leader = db.StringProperty(name='group-leader')
moraes
Thanks Moraes, it works now.
Ivan Slaughter