views:

50

answers:

1

this is my model:

class Geo(db.Model):
    entry = db.ListProperty(db.Key)

geo=Geo()
geo.entry.append(otherModel.key())

and the html is :

{% for i in geo.entry %}
        <p><a href="{{ i.link }}">{{ i.title }}</a></p>
{% endfor%}

but it show nothing,

i think maybe should :

class Geo(db.Model):
    entry = db.ListProperty(db.Model)
geo=Geo()
geo.entry.append(otherModel)

but it show :

ValueError: Item type Model is not acceptable

so , how to make the html shows the right thing.

thanks

+1  A: 

You can't use that template (or the like) to show the model directly, but you can easily prepare a context with a list of models by simply calling db.get on the list of keys -- e.g., have {'entries': db.get(listofkeys), ... at the start of your context dictionary, and for i in entries in the template.

Alex Martelli