Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in Statement-level triggers docs #175

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

g-nie
Copy link
Contributor

@g-nie g-nie commented Sep 11, 2024

Fixes a wrong model name in the code example of the "Statement-level triggers and transition tables" section.
I'm also using different field values for extra clarity.

docs/cookbook.md Outdated
@@ -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')])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should be [TrackedModel(field='old1'), TrackedModel(field='old2')]. The HistoryModel is what preserves the historical versions. We bulk create TrackedModel and the HistoryModel objects are created behind the scenes.

Definitely was a typo here at some point, so thanks for correcting it and making the example better!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, silly me 😅
Thanks, I just updated it

@wesleykendall
Copy link
Member

Had one correction, but otherwise I'm good to merge. I will fix it if I don't hear back. Thank you!

@g-nie g-nie requested a review from wesleykendall September 11, 2024 15:21
@wesleykendall wesleykendall merged commit a13ab33 into AmbitionEng:main Sep 12, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants