Think of it this way.
The original code says set user.blogs to be this list containing exactly
one Blog. SQLAlchemy does what you told it to and issues an update removing
the foreign key from all blog entries that originally pointed to this user
and then inserts a new entry pointing where you
Looks like the culprit is:
user.blogs = [Blog(title=input['blog_title']
this replaces your user.blogs relation with a single entry list containing
the last Blog
try this to add a Blog to the relation list
user.blogs.append(Blog(title=input['blog_title'))
--
Mike Conley
On Fri, Jun 5, 2009
Thanks Mike, it's working now. But I'm curious, how was the
foreignkey erased from the previous entry upon each newly added blog?
What does .append do that keeps the foreignkeys saved?
On Jun 6, 5:24 am, Mike Conley mconl...@gmail.com wrote:
Looks like the culprit is:
user.blogs =