diff --git a/CHANGES.rst b/CHANGES.rst index da3bf74b..21e5f3d4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -25,8 +25,8 @@ Unreleased - Added a "Changes" column to ``SimpleHistoryAdmin``'s object history table, listing the changes between each historical record of the object; see the docs under "Customizing the History Admin Templates" for overriding its template context (gh-1128) -- Fixed an issue causing m2m historical record to be saved even when - SIMPLE_HISTORY_ENABLED = False in settings.py (gh-1328) +- Fixed the setting ``SIMPLE_HISTORY_ENABLED = False`` not preventing M2M historical + records from being created (gh-1328) 3.5.0 (2024-02-19) ------------------ diff --git a/simple_history/tests/tests/test_models.py b/simple_history/tests/tests/test_models.py index c2eb327b..c047bfc5 100644 --- a/simple_history/tests/tests/test_models.py +++ b/simple_history/tests/tests/test_models.py @@ -2411,6 +2411,22 @@ def test_skip_history(self): self.assertEqual(skip_poll.history.all().count(), 2) self.assertEqual(skip_poll.history.all()[0].places.count(), 2) + @override_settings(SIMPLE_HISTORY_ENABLED=False) + def test_saving_with_disabled_history_doesnt_create_records(self): + # 1 from `setUp()` + self.assertEqual(PollWithManyToMany.history.count(), 1) + + poll = PollWithManyToMany.objects.create( + question="skip history?", pub_date=today + ) + poll.question = "huh?" + poll.save() + poll.places.add(self.place) + + self.assertEqual(poll.history.count(), 0) + # The count should not have changed + self.assertEqual(PollWithManyToMany.history.count(), 1) + def test_diff_against(self): self.poll.places.add(self.place) add_record, create_record = self.poll.history.all()