I programmed a small blog system in Python, Flask and made a little template where i can edit posts with CKEdit. I have five posts:
A, B, C, D, E
If i want to update post A, once i made the edit, i actually get edited +3 posts, in this case, post D. All the original content of post D is overwritten by the edited content of A and the original content of A is untouched.
This happens in all posts except the last one. If i want to edit D, i get editted the post B, but i I edit E, the post is succesfully edited.
I think it's some issue with the database pointer, but dont know how to work on it.
The update code is this:
def set_post(title, text, timestamp, page):
if page != '': #Update
data = Post.query.get(page)
data.title = title
data.text = text
db.session.commit()
[..]
I already checked the received "page" variable is correct (flash(page) just after the if sentence).
The underlying database engine is SQLLite 3.
Aucun commentaire:
Enregistrer un commentaire