开发者

Is there a way to set all db queries to only retrieve a given user's entries, or would each query throughout the app have to include "AND user..."?

I created an app that lets users input products and compare them. I am at the point where i need to consider scaling and multiple users, and I want to only show users the items that they've created (instead of the entire db, which may be an option at some point, but for now each user has to create their own lists).

Is there a canned/preferred way of making all queries throughout an app only return entries with the 开发者_Go百科"author" field set to a certain user, the logged in user? Or does every query have to be updated with "AND author..." type filter? Is this what namespaces are for?

I'm using Python on Google App Engine.


I would suggest looking into namespaces, it is exactly the type of use-case they are well suited for.

One note, if you want to be able to query users all users' products, you may be better off adding an owner property and using query filters. You can't currently query across namespaces -- only within a single namespace at one time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜