The model below doesn't seem to work with any of the import methods
laid out in this discussion and in the wiki. It has an "odd many-to-
many relationship" which is modeled following Gaeten's suggestion in
http://www.mail-archive.com/[EMAIL PROTECTED]/msg02616.html
man.py
------
from elixir import Entity, Field, Unicode, has_many
class Man(Entity):
name = Field(Unicode(10))
has_many('relationships', of_kind='Relationship')
def __repr__(self):
return '<Man \'%s\'>' % (self.name)
woman.py
--------
from elixir import Entity, Field, Unicode, has_many
class Woman(Entity):
name = Field(Unicode(10))
has_many('relationships', of_kind='Relationship')
def __repr__(self):
return '<Woman \'%s\'>' % (self.name)
relationship.py
---------------
from elixir import Entity, Field, Unicode, belongs_to
class Relationship(Entity):
name = Field(Unicode(10))
belongs_to('man', of_kind='Man', required=True)
belongs_to('woman', of_kind='Woman', required=True)
def __repr__(self):
return '<Relationship \'%s\'>' % (self.name)
Tested under Elixir 0.5.2
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---