From 3a02cc430a660513eaee8bde439029c06d19052e Mon Sep 17 00:00:00 2001 From: Conrad Date: Fri, 3 Jun 2022 12:07:12 +0200 Subject: [PATCH 1/7] Fixed simple typo --- docs/common_issues.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/common_issues.rst b/docs/common_issues.rst index 57dbdeea6..b6fdb0e8f 100644 --- a/docs/common_issues.rst +++ b/docs/common_issues.rst @@ -253,7 +253,7 @@ Working with BitBucket Pipelines -------------------------------- When using BitBucket Pipelines to test your Django project with the -django-simple-history middleware, you will run into an error relating to missing migrations relating to the historic User model from the auth app. This is because the migration file is not held within either your project or django-simple-history. In order to pypass the error you need to add a ```python manage.py makemigrations auth``` step into your YML file prior to running the tests. +django-simple-history middleware, you will run into an error relating to missing migrations relating to the historic User model from the auth app. This is because the migration file is not held within either your project or django-simple-history. In order to bypass the error you need to add a ```python manage.py makemigrations auth``` step into your YML file prior to running the tests. Using custom OneToOneFields From 63e49d9544148bba8d6454f8e1869ebb58dd573d Mon Sep 17 00:00:00 2001 From: Conrad Date: Fri, 3 Jun 2022 12:13:10 +0200 Subject: [PATCH 2/7] Added name to authors file --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 15e6911da..9dd4ebea1 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -25,6 +25,7 @@ Authors - Carlos San Emeterio (`Carlos-San-Emeterio `_) - Christopher Broderick (`uhurusurfa `_) - Christopher Johns (`tyrantwave `_) +- Conrad (`creyD `) - Corey Bertram - Craig Maloney (`craigmaloney `_) - Damien Nozay From 58c545f4ea9515fb757cc8f20f9299048cd7c307 Mon Sep 17 00:00:00 2001 From: Conrad Date: Fri, 3 Jun 2022 12:13:41 +0200 Subject: [PATCH 3/7] Added change to changelog --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index b970e6a08..1d4aef28d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Changes Unreleased ---------- +- Fixed a typo in the docs - Started using ``exists`` query instead of ``count`` in ``populate_history`` command (gh-982) 3.1.1 (2022-04-23) From 94a28497f36a1890c20c3541da26039318e3d368 Mon Sep 17 00:00:00 2001 From: Conrad Date: Fri, 3 Jun 2022 12:22:07 +0200 Subject: [PATCH 4/7] Fixed minor spelling issues in the docs --- docs/historical_model.rst | 2 +- docs/querying_history.rst | 6 +++--- docs/quick_start.rst | 4 ++-- docs/user_tracking.rst | 2 +- docs/utils.rst | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/historical_model.rst b/docs/historical_model.rst index cf23579ea..2cd5d748a 100644 --- a/docs/historical_model.rst +++ b/docs/historical_model.rst @@ -52,7 +52,7 @@ You're able to set a custom ``history_date`` attribute for the historical record, by defining the property ``_history_date`` in your model. That's helpful if you want to add versions to your model, which happened before the current model version, e.g. when batch importing historical data. The content -of the property ``_history_date`` has to be a datetime-object, but setting the +of the property ``_history_date`` has to be a ``datetime``-object, but setting the value of the property to a ``DateTimeField``, which is already defined in the model, will work too. diff --git a/docs/querying_history.rst b/docs/querying_history.rst index 725ec2bfb..23b30f780 100644 --- a/docs/querying_history.rst +++ b/docs/querying_history.rst @@ -144,7 +144,7 @@ If you use `as_of` to query history, the resulting instance will have an attribute named `_history` added to it. This property will contain the historical model record that the instance was derived from. Calling is_historic is an easy way to check if an instance was derived from a -historic timepoint (even if it is the most recent version). +historic point in time (even if it is the most recent version). You can use `to_historic` to return the historical model that was used to furnish the instance at hand, if it is actually historic. @@ -155,7 +155,7 @@ HistoricForeignKey If you have two historic tables linked by foreign key, you can change it to use a HistoricForeignKey so that chasing relations from an `as_of` -acquired instance (at a specific timepoint) will honor that timepoint +acquired instance (at a specific point in time) will honor that point in time when accessing the related object(s). This works for both forward and reverse relationships. @@ -219,7 +219,7 @@ To filter changes to the data, a relationship to the history can be established. Poll.objects.filter(history__history_user=4) -You can also prefetch the objects with this relationship using somthing like this for example to prefetch order by history_date descending: +You can also prefetch the objects with this relationship using something like this for example to prefetch order by history_date descending: .. code-block:: python diff --git a/docs/quick_start.rst b/docs/quick_start.rst index ffdb84bfc..dde7e9a19 100644 --- a/docs/quick_start.rst +++ b/docs/quick_start.rst @@ -141,14 +141,14 @@ tables in your database: .. _above: `Track History`_ -The two extra tables with ``historical`` prepended to their names are tables created +The two extra tables with ``historical`` prepend to their names are tables created by ``django-simple-history``. These tables store every change that you make to their respective base tables. Every time a create, update, or delete occurs on ``Choice`` or ``Poll`` a new row is created in the historical table for that model including all of the fields in the instance of the base model, as well as other metadata: - ``history_user``: the user that made the create/update/delete -- ``history_date``: the datetime at which the create/update/delete occurred +- ``history_date``: the ``datetime`` at which the create/update/delete occurred - ``history_change_reason``: the reason the create/update/delete occurred (null by default) - ``history_id``: the primary key for the historical table (note the base table's primary key is not unique on the historical table since there are multiple versions of it diff --git a/docs/user_tracking.rst b/docs/user_tracking.rst index 955328796..653b25e6a 100644 --- a/docs/user_tracking.rst +++ b/docs/user_tracking.rst @@ -58,7 +58,7 @@ Admin integration requires that you use a ``_history_user.setter`` attribute wit your custom ``_history_user`` property (see :doc:`/admin`). Another option for identifying the change user is by providing a function via ``get_user``. -If provided it will be called everytime that the ``history_user`` needs to be +If provided it will be called every time that the ``history_user`` needs to be identified with the following key word arguments: * ``instance``: The current instance being modified diff --git a/docs/utils.rst b/docs/utils.rst index 1c7bd429a..111836cac 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -43,7 +43,7 @@ If you find yourself with a lot of old history you can schedule the $ python manage.py clean_old_history --auto -You can use ``--auto`` to remove old historial entries +You can use ``--auto`` to remove old historical entries with ``HistoricalRecords`` or enumerate specific models as args. You may also specify a ``--days`` parameter, which indicates how many days of records you want to keep. The default it 30 days, meaning that From 251f7edec1a548007849076e1bf143cf34902134 Mon Sep 17 00:00:00 2001 From: Conrad Date: Fri, 3 Jun 2022 12:26:12 +0200 Subject: [PATCH 5/7] Updated german translation key --- simple_history/locale/de/LC_MESSAGES/django.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simple_history/locale/de/LC_MESSAGES/django.po b/simple_history/locale/de/LC_MESSAGES/django.po index 83097a6ee..ea47c0822 100644 --- a/simple_history/locale/de/LC_MESSAGES/django.po +++ b/simple_history/locale/de/LC_MESSAGES/django.po @@ -38,7 +38,7 @@ msgstr "%s wiederherstellen" #: simple_history/models.py:314 msgid "Created" -msgstr "Angelegt" +msgstr "Erstellt" #: simple_history/models.py:314 msgid "Changed" From 2f3dfa019a8dde22d85c4e3534a5cdf04621ea0a Mon Sep 17 00:00:00 2001 From: Conrad Date: Fri, 3 Jun 2022 12:59:10 +0200 Subject: [PATCH 6/7] Removed unused imports --- simple_history/utils.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/simple_history/utils.py b/simple_history/utils.py index e1ec61d9a..0664d9121 100644 --- a/simple_history/utils.py +++ b/simple_history/utils.py @@ -1,6 +1,3 @@ -import warnings - -import django from django.db import transaction from django.db.models import ForeignKey, ManyToManyField from django.forms.models import model_to_dict From daa20ef452e818669e55277407a9619c8a6bf8ea Mon Sep 17 00:00:00 2001 From: Conrad Date: Tue, 7 Jun 2022 13:43:01 +0200 Subject: [PATCH 7/7] Resolved problem --- AUTHORS.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 9dd4ebea1..f8b34c31d 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -25,7 +25,7 @@ Authors - Carlos San Emeterio (`Carlos-San-Emeterio `_) - Christopher Broderick (`uhurusurfa `_) - Christopher Johns (`tyrantwave `_) -- Conrad (`creyD `) +- Conrad (`creyD `_) - Corey Bertram - Craig Maloney (`craigmaloney `_) - Damien Nozay