I have query selecting list of users from the database. Every user object has list of tags. This is set in the Tag model using this relationship:
users = db.relationship('User', secondary=user_tag, backref=db.backref('tags', lazy='dynamic'), lazy='dynamic')
When the result from the query is returned I have user object:
id {int}1
tags {AppenderBaseQuery}(Select ...)
All good, but I want to assign new list to the tags property
user.tags=list()
but this row doesn't have any effect on the object and the user still contains the AppenderBaseQuery. How this property became immutable. I don't get it. Still new to python , sorry if the question is stupid.
EDIT:
I don't wont to change the database. I have tried to detach the user object from the session without success. I have the tags list already and just want to set it to the user object tags list. After I just serialize it to json and return response with list of users. Usualy I create for tags url, with url_for, but this time I want to return the tags lists with user to make the things faster