Thanks!  Worked very nicely.

On Apr 27, 11:06 am, Tim Hoffman <zutes...@gmail.com> wrote:
> HI
>
> You do need to append to the list.
>
> One way you would be to add a tuple to the list, first element is the
> parent, the second is the list
>
> ie
>
> Children.append((ItemVar,ChildrenVar))
>
> Alternately if you don't need order you could use a dictionary where
> the key is the parent;
>
> But
>
> If all you children are the same kind then you should just have the
> children hold a parent reference then
> in the parent use self.child_set.all() which will fetch all the Child
> kind that reference the parent,
>
> Rgds
>
> Tim
>
> On Apr 27, 8:39 am, dicko <d...@mothdesign.com.au> wrote:
>
> > Hi there
>
> > I'm looking for a way to iterate through referenced entities in a
> > template that are referenced as a list of keys rather than a reference
> > property.  For example:
>
> > ItemVar = db.GqlQuery("SELECT * from Items where Status  = :1",
> > "Active").fetch(100)
> >         for x in ItemVar:
> >             ChildrenVar = db.get(x.Children)
>
> > I then want to iterate through the results of ItemVar and ChildrenVar
> > in a template.  The problem I'm having is that ChildrenVar is only
> > filled with the last entity fetched for ItemVar.  I've also tried
> > setting up ChildrenVar as a list and appending it, e.g.:
>
> > ItemVar = db.GqlQuery("SELECT * from Items where Status  = :1",
> > "Active").fetch(100)
> >        ChildrenVar = []
> >        for x in ItemVar:
> >             ChildrenVar = ChildrenVar + db.get(x.Children)
>
> > This works except the results don't appear to be tied to the initial
> > parent entity in any way.  Obviously I haven't set up 'Children' as a
> > Reference property because there are multiple entities to be
> > referenced.
>
> > Also, I'm a total beginner so I don't know what I'm doing so small
> > pieces of example code would be awesome!!
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
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 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to