Reputation: 990
I am using a DateTimeProperty on GAE Datastore.
date_posted = db.DateTimeProperty()
I then need to make a comparison with jinja2.
{% if i.date_posted is defined %}
{{ i.date_posted.strftime('%d %b %Y') }}
{% else %}
No
{% endif %}
On GAE SDK Console, my entry says:
date_posted (None)
But my comparison doesn't pick it up as null.
Upvotes: 0
Views: 68
Reputation: 1486
You can try this:
{{ i.date_posted.strftime('%d %b %Y') if i.date_posted != None }}
Upvotes: 1