I have a many-to-many relationship with attributes:

Parent - AssocObject - Child

I'm trying to set it up so that when an AssocObject is removed from parent,
that instance of AssocObject and the Child are also deleted. So in my view I
do:

del parent.associatedobjects

I have changed the model so that the definition of Parent includes

associatedobjects = relationship("AssocObject", cascade = "delete,
delete-orphan")

This seems to work, however when I then try to add a new AssocObject:

parent.associatedobjects[0] = AssocObject()

I get a warning:

Object of type <AssocObject> not in session, add operation along
'Parent.associatedobjects' will not proceed


What am I doing wrong?

Thanks,
Ben

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to