On Feb 23, 2011, at 8:45 PM, Maxim Oganesyan wrote:

> Hi, all.
> 
> I know, it's a stupid question, but I lost whole the day to find an
> answer and didn't find it.
> 
> Can somebody explain, how to brake many-to-many relation?
> 
> For example, I'd like to remove 'manager' user from 'managers' group
> (based on default model). What should I write?
> 
> I tried code like:
> DBSession.query
> ( user_group_table ).filter(and_(user_group_table.c.user_id==1 
> ,user_group_table.c.group_id==1 )).delete()
> 
> but "Server Error" is returned.
> 
> Is there any simplier and easier way?

You just remove the group from the user-list I'd say. I don't use SA mapper, 
but Elixir instead, but I'd just try:

user.groups.remove(group)

Diez

-- 
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?hl=en.

Reply via email to