In templates you can call methods of instances. In templates you do not need to use parentheses. Restriction: you can't call method with arguments.
For more information, look at django template engine documentation: http://docs.djangoproject.com/en/dev/topics/templates/ In you case use: {{ entry.key.name }} or {{ entry.key.id }} On Nov 26, 8:32 am, mawei1981 <[EMAIL PROTECTED]> wrote: > Example: > > I have a entry > > class Entry(db.Model): > author = db.UserProperty() > title = db.StringProperty() > content = db.TextProperty() > date = db.DateTimeProperty(auto_now_add=True) > tags = db.ListProperty(db.Key) > > the I write the follow code in the webhandler: > > entries = Entry.all().order('-date').fetch(limit=5) > > the end, I write the code in the html tmeplate: > > {% for entry in entries %} > > <div class="post" id="post1"> > <div class="date"><span>{{entry.date|date:"D d M Y" }}</span></div> > <div class="title"><h2><a href="{{entry.id}}">{{entry.title}}</a></ > h2> > <div class="postdata"><span class="category"> > {% for tag in entry.fetched_tags %} > {{tag.tag}}, > {%endfor%} > </span> > <span class="comments">no comments</span></div> > </div> > <div class="entry"> > {{entry.content|linebreaks }} > </div><!--/entry --> > </div><!--/post --> > {% endfor %} > > -------------- > > <div class="title"><h2><a href="{{entry.id}}">{{entry.title}}</a></h2> > > Here I want to use the Primary key for the entry , that I will select > it by the pK? > > who know that? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
