the friends is a sub-list of memory entity.
Why not load the list on lazy mode.

Faint, I will manual get the lists .
But how can I put the sub-list to the object.

does google provide sample code on this.

On Nov 4, 4:30 pm, Alexander Kojevnikov <[EMAIL PROTECTED]>
wrote:
> db.ListProperty(db.Key) does not automatically de-reference entities,
> you will need to do it yourself before passing them to the template.
>
> On Nov 4, 7:13 pm, mawei1981 <[EMAIL PROTECTED]> wrote:
>
> > I hava ManyToMany field in a entity
>
> > class Memory(db.Model):
> >         author = db.UserProperty()
> >         title = db.StringProperty()
> >         content = db.StringProperty(multiline=True)
> >         year = db.StringProperty()
> >         date = db.DateTimeProperty(auto_now_add=True)
> >         friends = db.ListProperty(db.Key)
>
> > class Friends(db.Model):
> >         friend_type = db.StringProperty()
> >         email = db.EmailProperty()
> >         name = db.StringProperty()
>
> >         @property
> >         def memories(self):
> >                 return Memory.gql("where friends = :1",self.key())
>
> > -----------------
>
> >                 memory_query = Memory.all().order('-date')
>
> > -----------------
>
> >         <h1>My Memory</h1>
> >         <hr>
> >     {% for memory in memories %}
> >       {% if memory.author %}
> >         <b>{{ memory.author.nickname }}</b> wrote:
> >       {% else %}
> >        An anonymous person wrote:
> >       {% endif %}
> >       <blockquote>{{ [EMAIL PROTECTED]</blockquote>
> > <p>
> >         {% for friend in memory.friends %}
> > {{friend.Key}}
> > {{friend.name}}
> > {{friend.email}}
> >         {%endfor%}
> > </p>
> > <p>{{memory.content}}</p>
> > {% endfor %}
>
> > -------------------------
>
> > I could not get the friends info/
>
> > -----
>
> > appengine dataviewer show the following:
>
> > [datastore_types.Key.from_path('Friends', 202L, _app=u'myom'),
> > datastore_types.Key.from_path('Friends', 8L, _app=u'myom')]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to