[Answered ]-Google app engine and django templates: passing entity ids to the template engine

2👍

The template code is no different in that you still need to access the id instance-method of the key.

Try instead:

{% for message in messages %}
   {{ message.name }}
   {{ message.key.id }}
   <!-------- ^^^ -->
{% endfor %}

The syntax, if you use Jinja2 templates (instead of Django templates), would be:

{% for message in messages %}
   {{ message.name }}
   {{ message.key().id() }}
   <!-------- ^^^^^ -->
{% endfor %}

Leave a comment