Note
When you call , the number of rows modified is returned.
herb = Person.create(name='Herb', birthday=date(1950, 5, 5))
To update a row, modify the model instance and call save()
to persist the changes. Here we will change Grandma’s name and then save the changes in the database:
Now we have stored 3 people in the database. Let’s give them some pets. Grandma doesn’t like animals in the house, so she won’t have any, but Herb is an animal lover:
herb_mittens = Pet.create(owner=herb, name='Mittens', animal_type='cat')
Note
The return value of is the number of rows removed from the database.
herb_fido.save()