I've read the similar question on adding tags to a Django Blog model, where it mentions maintaining tags on the article as a StringList and a separate object to keep a count of these objects, which is good because I'd basically come up with the same idea myself, however I'm stru开发者_运维百科ggling to work how how to maintain the count.
I'm overriding the put() method of the main object, but how do I check to see if the tags have changed compared to the object currently stored? Is there any way to cheaply check the existing data without fetching a 2nd copy of the object?
One way to handle it is to store each object in memcache and only fetch the ones it doesn't find in there, but for a busy site, you're still going to be hitting the datastore quite often.
Check out taggable-mixin. It's a pretty straightforward way to add tags to any AppEngine model class as a mixin.
精彩评论