I follow the indentities quickstart,
and create schema like this:
user_group = Table("user_group", metadata,
Column("user_id", Integer,
ForeignKey("tg_user.user_id"),
primary_key=True),
Column("group_id", Integer,
ForeignKey("tg_group.group_id"),
primary_key=True))
class Group(ActiveMapper):
class mapping:
group_id = column(Integer, primary_key=True)
group_name = column(Unicode(16), unique=True)
users = many_to_many("User", user_group, backref="groups")
class User(ActiveMapper):
class mapping:
user_id = column(Integer, primary_key=True)
user_name = column(Unicode(16), unique=True)
groups = many_to_many("Group", user_group, backref="users")
But I can't make relation between user and group, I throw exception:
AttributeError: 'User' object has no attribute 'groups'
while I "u.groups.append(g)"
How can I make the user link with group?
--
I'm lazy, I'm coding.
http://lazycoding.blogspot.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---