views:

143

answers:

1

I am using aep on google app engine

class Link():
     bag  = db.Referencepropery(Bag) #bag have name, id and other property
     name = db.Stringpropery


object_query = Link.all();
p = paginator( object_query)
object_list = p.page(1);
prefetch_references( object_list.object_list, 'bag')

render_to_response(...,{'object_list':object_list.object_list},...)


#template
{% for object in object_list%}
 {{object.bag.id}} <!--failed to get any value, why???/-->
{% end %}
+1  A: 

There's several things wrong with your code:

  • Your model classes need to extend db.Model
  • Your properties need to call the constructor, not just reference it
  • A StringProperty isn't a reference, so "prefetch_reference(objectlist, 'name')" doesn't make any sense.

Here's one that makes a bit more sense:

class Link(db.Model):
     bag = db.ReferenceProperty(Bag) #bag have name, id and other property
     name = db.StringPropery()

def view():
     objectlist = get_object_list(.....)
     prefetch_reference(objectlist,'name')
Nick Johnson
I am sorry for quick problem, I did exactly as you do, but I just fail to achieve thatI have detailed my problem
zinking