Jinja2 returns "None" string for Google App Engine models

Posted by Brian M. Hunt on Stack Overflow See other posts from Stack Overflow or by Brian M. Hunt
Published on 2010-04-22T23:15:57Z Indexed on 2010/04/22 23:23 UTC
Read the original article Hit count: 441

Filed under:
|
|
|

Google App Engine models, likeso:

from google.appengine.ext.db import Model

class M():
    name = db.StringProperty()

Then in a Jinja2 template called from a Django view with an in instance of M passed in as m:

The name of this M is {{ m.name }}.

When m is initialized without name being set, the following is printed:

The name of this M is None.

The preferable and expected output (and the output when using Django templates) would be/is:

The name of this M is .

Do you know why this is happening, and how to get the preferred & expected output?

© Stack Overflow or respective owner

Related posts about google-app-engine

Related posts about jinja2