Print application model object id in html template

The following is a simple database model:

class Notes(db.Model):
  text = db.StringProperty(multiline=True)
  date = db.DateTimeProperty(auto_now_add=True)

Now in the URL handler, I send all the notes to the template as follows:

class MainPage(webapp2.RequestHandler):
  def get(self):
    notes = Notes.all()
    self.render_template("index.html", {'notes':notes})

In the template, I use the jinja2 templating engine, I want ideach of the notes to be printed, so that I can insert an edit link, something like this:

{% for note in notes %}
<p>  
 {{ note.text }} <br>
 {{ note.date }} <br>
 (<a href ="edit/{{note.key.id}}">edit </a>)
{% endfor %}

But the problem is that I do not see anything printed instead note.key.id . According to the docs above , the key class is a unique key for the database object, and it has a method id, its numerical value. for one note from the collection of notes I want idnotes.

django, {{ notes.key.id }}, jinja2 .

?

+5
1

href :

(<a href ="edit/{{note.key().id()}}">edit </a>)

.

+11

All Articles