Skip to content

Commit

Permalink
Fix typo in Statement-level triggers docs (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-nie authored Sep 12, 2024
1 parent b29a29f commit a13ab33
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([TrackedModel(field='old1'), TrackedModel(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 a13ab33

Please sign in to comment.