I have stored data in the gae datastore, but when I query the data and reference the properties I seem to be getting a reference to the object rather than the value of the attribute.
class ClassDefinitions(db.Model):
class_name = db.StringProperty
class_definition = db.TextProperty
class FlexEntityAdminHandler(webapp.RequestHandler):
def get(self):
query = db.GqlQuery("SELECT * FROM ClassDefinitions")
definitions = query.fetch(1000, 0)
for definition in definitions:
logging.info("Name: %s", definition.class_name)
logging.info("Def: %s", definition.class_definition)
When I reference definition.class_name I get:
<class 'google.appengine.ext.db.StringProperty'>
Instead of the value that I stored. I know that it is getting stored because each time I add a new entry the number of results from the query increases by 1. Does anyone know what I’m doing wrong?
When creating the model, you need to create actual instances of the property type classes:
(Note the
().)