- Django 2 by Example
- Antonio Melé
- 54字
- 2021-06-25 21:19:01
Updating objects
Now, change the title of the post to something different and save the object again:
>>> post.title = 'New title'
>>> post.save()
This time, the save() method performs an UPDATE SQL statement.
The changes you make to the object are not persisted to the database until you call the save() method.