Favoriting system on Appengine
- by Mateusz Cieslak
Hi,
I have the following model structure
class Authors(db.Model) :
nickname = db.StringProperty(required=True)
fullname = db.StringProperty(required=True)
class Articles(db.Model) :
title = db.StringProperty(required=True)
body = db.StringProperty(required=True)
author = db.ReferenceProperty(Authors, required=True)
class Favorites(db.Model) :
who = db.ReferenceProperty(Authors, required=True)
what = db.ReferenceProperty(Articles, required=True)
I'd like to display 10 last articles according to this pattern: article.title, article.body, article.author(nickname), info if this article has been already favorited by the signed in user.
I have added a function which I use to get the authors of these articles using only one query (it is described here)
But I don't know what to do with the favorites (I'd like to know which of the displayed articles have been favorited by me using less than 10 queries (I want to display 10 articles)). Is it possible?