Skip to content

Commit

Permalink
fix typo in Statement-level triggers docs
Browse files Browse the repository at this point in the history
  • Loading branch information
g-nie committed Sep 11, 2024
1 parent b29a29f commit b9b6bb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class TrackedModel(models.Model):
With this statement-level trigger, we have the benefit that only one additional query is performed, even on bulk inserts to the tracked model. Here's some example code to illustrate what the results look like.

```python
TrackedModel.objects.bulk_create([LoggedModel(field='old'), LoggedModel(field='old')])
TrackedModel.objects.bulk_create([HistoryModel(field='old1'), HistoryModel(field='old2')])

# Update all fields to "new"
TrackedModel.objects.update(field='new')
Expand All @@ -388,10 +388,10 @@ TrackedModel.objects.update(field='new')
print(HistoryModel.values('old_field', 'new_field'))

>>> [{
'old_field': 'old',
'old_field': 'old1',
'new_field': 'new'
}, {
'old_field': 'old',
'old_field': 'old2',
'new_field': 'new'
}]
```
Expand Down

0 comments on commit b9b6bb7

Please sign in to comment.