Hi everyone,
I've been using Elixir in my website for a while, but I think what I'm trying
to do now is beyond my skill level, so I'm wondering if someone can help.
Basically I'm writing a blog engine. (Like everyone else, I know) Well, not
just a blog engine - it has bloggish features, like comments and tags, but
there are also a variety of different things (i.e. more than just blog posts)
that can have tags or comments. So my first thought was to make a Taggable
class to serve as a superclass of anything that could be tagged, and a
Commentable class to serve as a superclass of anything that could be commented
on.
class Tag(Entity):
name = Field(Unicode(128), primary_key=True)
tagged = ManyToMany('Taggable')
class Taggable(Entity):
tags = ManyToMany('Tag')
class Comment(Entity):
text = Field(UnicodeText)
parent = ManyToOne('Commentable')
class Commentable(Entity):
comments = OneToMany('Comment')
The experts on this list can probably see where this is going: when I try to
do a concrete implementation like so:
class Post(Taggable,Commentable):
text = Field(UnicodeText)
I get an error:
Exception: Post entity inherits from several entities, and this is not
supported.
So I wanted to ask, is there some recommended way to do what I'm trying to do?
(Is it actually possible?) I need the association to work both ways, e.g. I
need to be able to easily access both the parent of a Comment, and all
comments attached to the parent. Any recommendations, suggestions, or
solutions would be much appreciated.
:) David
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en.