diff --git a/docs/querying_history.rst b/docs/querying_history.rst index 7cd99cb9..bdf33971 100644 --- a/docs/querying_history.rst +++ b/docs/querying_history.rst @@ -175,12 +175,11 @@ model history. -Save Without Creating Historical Records +Save without creating historical records ---------------------------------------- If you want to save model objects without triggering the creation of any historical -records, you can set a ``skip_history_when_saving`` attribute to ``True`` -on each object before saving - for example like this: +records, you can do the following: .. code-block:: python @@ -189,7 +188,7 @@ on each object before saving - for example like this: # We recommend deleting the attribute afterward del poll.skip_history_when_saving -This also works when creating an object, but only when calling the ``save`` method: +This also works when creating an object, but only when calling ``save()``: .. code-block:: python @@ -199,6 +198,9 @@ This also works when creating an object, but only when calling the ``save`` meth poll.save() del poll.skip_history_when_saving +.. note:: + Historical records will always be created when calling the ``create()`` manager method. + Alternatively, call the ``save_without_historical_record()`` method on each object instead of ``save()``. This method is automatically added to a model when registering it for history-tracking diff --git a/simple_history/models.py b/simple_history/models.py index 45da0801..3ffe42a5 100644 --- a/simple_history/models.py +++ b/simple_history/models.py @@ -182,7 +182,7 @@ def save_without_historical_record(self, *args, **kwargs): """ Save the model instance without creating a historical record. - *Make sure you know what you're doing before using this method.* + Make sure you know what you're doing before using this method. """ self.skip_history_when_saving = True try: