Thanks for answering. The taggable mixin you mentioned it sort of what I need, but I'd like to use composition instead of multiple inheritance. I need Tag to be not just a string, but have other attributes and methods as well.
And the parent approach... I can't have multiple parents, can I? Which means I can't trace associated tags from a Content. On Dec 12, 3:13 am, Robert Kluin <robert.kl...@gmail.com> wrote: > You could add a StringListProperty called tags to the content model. Or, > when you create a new Tag you could make a Content model its parent. So, > > class Content(db.Model): > content = db.TextProperty() > tags = StringListProperty() > > or, > class Content(db.Model): > content = db.TextProperty() > > class Tags(db.Model): > tags = StringListProperty() > > content = Content(content="Some content") > content.put() > > tags = Tags(tags=['tag1','tag2','tag3'], parent=content) > tags.put() > > There are a number of other ways to handle tags as well. It just depends on > your intended usage. If you search the list you will find some recent posts > referencing a "taggable mixin." I have not used it yet, but it looks > interesting. > > Robert > > > > On Fri, Dec 11, 2009 at 11:52 AM, hyn <hisaoki.nish...@gmail.com> wrote: > > Let's say I have a Tag(db.Model) class and a Content(db.Model) > > I'm trying to create a list of Tags as an attribute of Content. > > How do I go about doing this? > > > Accoring to the docs ListProperty item_type must be one of the > > Property subclasses, so I can't use my Tag class as item_type. > > > I'm new to Python and server side in general... I appreciate your > > help. > > > -- > > > You received this message because you are subscribed to the Google Groups > > "Google App Engine" group. > > To post to this group, send email to google-appeng...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-appengine+unsubscr...@googlegroups.com<google-appengine%2Bunsubscrib > > e...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-appengine?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.