Store model history and view/revert changes from admin site.

Overview

django-simple-history

Build Status Documentation Status Test Coverage PyPI Version Maintainability Downloads Code Style Jazzband

django-simple-history stores Django model state on every create/update/delete.

This app supports the following combinations of Django and Python:

Django Python
2.2 3.5, 3.6, 3.7, 3.8, 3.9
3.0 3.6, 3.7, 3.8, 3.9
3.1 3.6, 3.7, 3.8, 3.9

Getting Help

Documentation is available at https://django-simple-history.readthedocs.io/

Pull requests are welcome. Read the CONTRIBUTING file for tips on submitting a pull request.

License

This project is licensed under the BSD 3-Clause license.

Comments
  • Allow the use of multiple databases

    Allow the use of multiple databases

    Right now, this library does not support saving historical to a database separate from its operational model. This PR allows the historical record to be saved to the same db as the historical record table.

    Description

    • Save historical record to the database associated with the historical record table by passing in the db alias contained in the historical instance.

    Motivation and Context

    As of now, the historical records are created using the database associated with the operational model being tracked, not the database associated with the historical table. That means if the operational model is in a separate database, the library attempts to look up the historical table in the operational database, and subsequently fails.

    How Has This Been Tested?

    So far, I have not been able to get the full test suite to run locally.

    That being said, the tests involve creating a record on a second database by passing the db name into the HistoricalRecords constructor and then asserting its existence.

    Types of changes

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist:

    • [x] I have run the make format command to format my code
    • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] I have added my name and/or github handle to AUTHORS.rst
    • [x] I have added my change to CHANGES.rst
    • [x] All new and existing tests passed.
    accepted 
    opened by dopatraman 48
  • Prepare for Django 2.0

    Prepare for Django 2.0

    I was trying to get django-simple-history working with Django 2.0. Here are the changes I made to get it run. (No guarantee for completeness or correct downward compatibility)

    opened by flesser 28
  • Extend `as_of` to return a queryset instead of a list of instances (both are iterable).

    Extend `as_of` to return a queryset instead of a list of instances (both are iterable).

    Description

    The discussion in #397 is about using filtering and querysets with point-in-time queries. The current as_of implementation returns a instance generator so it can only be used to make a single query and obtain the result. The documentation states that it must return an iterable, so it does not have to be a generator. As a queryset, no tests needed to change to handle it.

    HistoricalQuerySet is now returned from queries on history. This is used internally by as_of queries to prune results to the latest of each primary key, and to convert to instances.

    The resulting queryset from as_of can be further filtered; any use of pk will be converted to the original model's primary key if the queryset is returning instances.

    Example (from unit tests):

        def test_as_of(self):
            """Demonstrates how as_of works now that it returns a QuerySet."""
            t0 = datetime.now()
            document1 = RankedDocument.objects.create(rank=42)
            document2 = RankedDocument.objects.create(rank=84)
            t1 = datetime.now()
            document2.rank = 51
            document2.save()
            document1.delete()
            t2 = datetime.now()
    
            # nothing exists at t0
            queryset = RankedDocument.history.as_of(t0)
            self.assertEqual(queryset.count(), 0)
    
            # at t1, two records exist
            queryset = RankedDocument.history.as_of(t1)
            self.assertEqual(queryset.count(), 2)
            self.assertEqual(queryset.filter(rank__gte=75).count(), 1)
            ids = set([item["id"] for item in queryset.values("id")])
            self.assertEqual(ids, {document1.id, document2.id})
    
            # at t2 we have one record left
            queryset = RankedDocument.history.as_of(t2)
            self.assertEqual(queryset.count(), 1)
            self.assertEqual(queryset.filter(rank__gte=75).count(), 0)
    
    

    Related Issues

    #118 #229 #354 This closes #397 #715 #758 This closes #803

    Motivation and Context

    A long-standing issue that kept me from using the library effectively.

    How Has This Been Tested?

    Tests were added, all tests pass. Existing tests did not have to change. Additionally, my company has been using this in production for over a month.

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [X] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist:

    • [X] I have run the make format command to format my code
    • [X] My change requires a change to the documentation.
    • [X] I have updated the documentation accordingly.
    • [X] I have read the CONTRIBUTING document.
    • [X] I have added tests to cover my changes.
    • [X] I have added my name and/or github handle to AUTHORS.rst
    • [X] I have added my change to CHANGES.rst
    • [X] All new and existing tests passed.
    opened by jeking3 25
  • Integrate DJ2.1

    Integrate DJ2.1 "view" permissions for both model and historical model

    In some scenarios, it is not ideal to allow users to revert a model instance to a previous version. Django 2.1 introduced view permissions which, if integrated into DSH, would give an administrator the ability to allow a user to add/change a model but not revert to a previous instance through the model's history.

    Description

    The SimpleHistoryAdmin reviews the historical model instance permissions instead of just the model instance by overriding the has_xxxx_permission methods in ModelAdmin.

    • enable this feature through settings (SIMPLE_HISTORY_PERMISSIONS_ENABLED);

    • honor superuser privileges;

    • user/group permissions granted for the historical model cannot exceed those of the model. That is, granting view and change permissions for the historical model but only view permission for the model means the user has view permission only for the historical model;

    • text on the changelist and form becomes context sensitive (change permission vs view permission);

    • setting SIMPLE_HISTORY_REVERT_DISABLED=True limits all users (other than superuser) to view access. (this works for all Django versions)

    • the [Revert] button is changed to a [Close] button if the user has: -- if Django >= 2.1, feature is disabled, and has view on model; -- if Django >= 2.1, feature is enable and has view model permission and view historical model permission; -- if settings. SIMPLE_HISTORY_REVERT_DISABLED = True (regardless of Django version).

    How Has This Been Tested?

    See tests in test_admin_with_permissions.py

    A few tests in test_admin.py required very minor modifications.

    Screenshots (if appropriate):

    For a user with "view" only permission on a historical object, the changelist looks like this: 20_permissions

    and the form looks like this: 30_permissions

    Types of changes

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [x] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist:

    • [x] I have run the make format command to format my code
    • [x] My change requires a change to the documentation.
    • [x] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] I have added my name and/or github handle to AUTHORS.rst
    • [x] I have added my change to CHANGES.rst
    • [x] All new and existing tests passed.
    accepted 
    opened by erikvw 21
  • Track history of M2M fields

    Track history of M2M fields

    Initial work done in #370 by @avalanchy. Open to discussion here of how we might want to track history on M2M fields and see if that's a feature we want to accept.

    decision-needed help-wanted 
    opened by rossmechanic 21
  • Time for a new release?

    Time for a new release?

    It's been a while since 3.0.0 and a lot has been done. Is it time for 3.1.0/4.0.0?

    In my case, I need https://github.com/jazzband/django-simple-history/pull/866, and I'm finding myself installing git+https://github.com/jazzband/django-simple-history#master to be able to use it.

    opened by 1ace 20
  • Add Many-to-Many support

    Add Many-to-Many support

    As implemented in this fork: https://bitbucket.org/joaofrancese/django-simple-history/src/0d1630812d2eed3718eabf350d27425af0521a51/simple_history/models.py?at=default

    enhancement P3 decision-needed PyCon2014 Sprint 
    opened by treyhunner 19
  • Django 2.0 compatibility

    Django 2.0 compatibility

    I try to update my website to Django 2.0 and got an error for simple_history/models.py

      File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/db/models/base.py", line 308, in __new__
        new_class._prepare()
      File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/db/models/base.py", line 363, in _prepare
        class_prepared.send(sender=cls)
      File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/dispatch/dispatcher.py", line 178, in send
        for receiver in self._live_receivers(sender)
      File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/django/dispatch/dispatcher.py", line 178, in <listcomp>
        for receiver in self._live_receivers(sender)
      File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/simple_history/models.py", line 94, in finalize
        history_model = self.create_history_model(sender)
      File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/simple_history/models.py", line 129, in create_history_model
        fields = self.copy_fields(model)
      File "/home/bernd/.local/share/virtualenvs/bit-a8MytMjT/lib/python3.5/site-packages/simple_history/models.py", line 176, in copy_fields
        old_field.rel.to,
    AttributeError: 'ForeignKey' object has no attribute 'rel'
    
    opened by brot 17
  • Most recent with excluded fields

    Most recent with excluded fields

    Description

    Added changes in manager to compensate for excluded fields while feetching most recent. Updated test_model_with_excluded_fields test to verify.

    Related Issue

    Steps to reproduce:

    • Create a model with a historical records field
    • Add an excluded model field in historical records
    • Query for most_recent of the model's history field https://github.com/treyhunner/django-simple-history/issues/333

    Motivation and Context

    How Has This Been Tested?

    Screenshots (if appropriate):

    Types of changes

    • [x] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist:

    • [x] My code follows the code style of this project.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] All new and existing tests passed.
    opened by Alig1493 16
  • Enable diffing m2m fields

    Enable diffing m2m fields

    At first @avalanchy did the initial work. After that https://github.com/bmedx made an excellent PR based on his work which wasn't completed, so I tried to make it work and created a PR myself, based on https://github.com/edx-unsupported/django-simple-history/pull/1 and rebased on the current master.

    Description

    This PR enables tracking history of m2m relations. It works in my specific situation, however I would be happy to hear if there are any situations I haven't looked at, I should cover or simply could be improved.

    Related Issue

    #399 - Track history of M2M fields

    Motivation and Context

    A few days ago I received the question "how can I see who has removed an article from this category?" I immediately dove into the history I had enabled, but I quickly discovered that m2m relations weren't tracked. I started googling for solutions and stumbled upon the Pull Request @bmedx made for #399. I installed his fork and after some minor tweaks and a rebase, I made it work for my situation. It tracks each m2m change in a separate m2m_history model, so that you won't need a reference to the actual referenced model.

    How Has This Been Tested?

    Tests have been included, however I'm unsure if they are enough to cover all use cases.

    Type of change

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [X] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to change)

    Checklist:

    • [X] I have run the pre-commit run command to format and lint.
    • [X] My change requires a change to the documentation.
    • [X] I have updated the documentation accordingly.
    • [X] I have read the CONTRIBUTING document.
    • [X] I have added tests to cover my changes.
    • [X] I have added my name and/or github handle to AUTHORS.rst
    • [X] I have added my change to CHANGES.rst
    • [X] All new and existing tests passed.
    opened by thijskramer 15
  • Implement Jazzband guidelines for django-simple-history

    Implement Jazzband guidelines for django-simple-history

    This issue tracks the implementation of the Jazzband guidelines for the project django-simple-history

    It was initiated by @treyhunner who was automatically assigned in addition to the Jazzband roadies.

    See the TODO list below for the generally required tasks, but feel free to update it in case the project requires it.

    Feel free to ping a Jazzband roadie if you have any question.

    TODOs

    • [x] Fix all links in the docs (and README file etc) from old to new repo
    • [x] Add the Jazzband badge to the README file
    • [x] Add the Jazzband contributing guideline to the CONTRIBUTING.md or CONTRIBUTING.rst file
    • [x] Check if continuous testing works (e.g. Travis CI, CircleCI, AppVeyor, etc)
    • [x] Check if test coverage services work (e.g. Coveralls, Codecov, etc)
    • [x] Add jazzband account to PyPI project as maintainer role (e.g. URL: https://pypi.org/manage/project/django-simple-history/collaboration/)
    • [x] Add jazzband-bot as maintainer to the Read the Docs project (e.g. URL: https://readthedocs.org/dashboard/django-simple-history/users/)
    • [x] Add incoming GitHub webhook integration to Read the Docs project (e.g. URL: https://readthedocs.org/dashboard/django-simple-history/integrations/)
    • [x] Fix project URL in GitHub project description
    • [x] Review project if other services are used and port them to Jazzband
    • [x] Decide who is project lead for the project (if at all)
    • [x] Set up CI for Jazzband project releases if needed and open ticket if yes

    Project details

    Description Store model history and view/revert changes from admin site.
    Homepage https://django-simple-history.readthedocs.org
    Stargazers 1012
    Open issues 50
    Forks 293
    Default branch master
    Is a fork False
    Has Wiki False
    Has Pages False
    opened by jazzband-bot 15
  • Bump tox from 3.27.1 to 4.2.5 in /requirements

    Bump tox from 3.27.1 to 4.2.5 in /requirements

    Bumps tox from 3.27.1 to 4.2.5.

    Release notes

    Sourced from tox's releases.

    4.2.5

    What's Changed

    Full Changelog: https://github.com/tox-dev/tox/compare/4.2.4...4.2.5

    4.2.4

    What's Changed

    Full Changelog: https://github.com/tox-dev/tox/compare/4.2.3...4.2.4

    4.2.3

    What's Changed

    Full Changelog: https://github.com/tox-dev/tox/compare/4.2.2...4.2.3

    4.2.2

    What's Changed

    Full Changelog: https://github.com/tox-dev/tox/compare/4.2.1...4.2.2

    4.2.1

    What's Changed

    New Contributors

    Full Changelog: https://github.com/tox-dev/tox/compare/4.2.0...4.2.1

    4.2.0

    What's Changed

    Full Changelog: https://github.com/tox-dev/tox/compare/4.1.3...4.2.0

    4.1.3

    ... (truncated)

    Changelog

    Sourced from tox's changelog.

    v4.2.5 (2023-01-06)

    Bugfixes - 4.2.5

    - The combination of ``usedevelop = true`` and ``--skip-missing-interpreters=false`` will no longer fail for environments
      that were *not* invoked - by :user:`stephenfin`. (:issue:`2811`)
    - Fix an attribute error when ``use_develop = true`` is set and an unsupported interpreter version is requested - by
      :user:`stephenfin`. (:issue:`2826`)
    - tox returns a non-zero error code if all envs are skipped. It will now correctly do this if only a single env was
      requested and this was skipped - by :user:`stephenfin`. (:issue:`2827`)
    

    v4.2.4 (2023-01-05)

    Bugfixes - 4.2.4

    • Setting [testenv] basepython = python3 will no longer override the Python interpreter version requested by a factor, such as py311 - by :user:stephenfin. (:issue:2754)
    • Also accept tab after colon before factor filter expansion - by :user:pdecat. (:issue:2823)

    v4.2.3 (2023-01-04)

    Bugfixes - 4.2.3

    - ``devenv`` does not respect the specified path when the package is a wheel file - by :user:`gaborbernat`. (:issue:`2815`)
    - Require space after colon before factor filter expansion, unless it is the last character of the line - by :user:`pdecat`. (:issue:`2822`)
    

    v4.2.2 (2023-01-04)

    Bugfixes - 4.2.2

    • Add CC, CFLAGS, CCSHARED, CXX, CPPFLAGS, LDFLAGS, PKG_CONFIG and PKG_CONFIG_SYSROOT_DIR to the default passed through environment variables list as these are needed for building various C-extensions
      • by :user:gaborbernat. (:issue:2818)

    v4.2.1 (2023-01-03)

    Bugfixes - 4.2.1

    - Fix extracting extras from markers with more than 2 extras in an or chain - by :user:`dconathan`. (:issue:`2791`)
    

    </tr></table>

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump coverage from 6.5.0 to 7.0.3 in /requirements

    Bump coverage from 6.5.0 to 7.0.3 in /requirements

    Bumps coverage from 6.5.0 to 7.0.3.

    Changelog

    Sourced from coverage's changelog.

    Version 7.0.3 — 2023-01-03

    • Fix: when using pytest-cov or pytest-xdist, or perhaps both, the combining step could fail with assert row is not None using 7.0.2. This was due to a race condition that has always been possible and is still possible. In 7.0.1 and before, the error was silently swallowed by the combining code. Now it will produce a message "Couldn't combine data file" and ignore the data file as it used to do before 7.0.2. Closes issue 1522_.

    .. _issue 1522: nedbat/coveragepy#1522

    .. _changes_7-0-2:

    Version 7.0.2 — 2023-01-02

    • Fix: when using the [run] relative_files = True setting, a relative [paths] pattern was still being made absolute. This is now fixed, closing issue 1519_.

    • Fix: if Python doesn't provide tomllib, then TOML configuration files can only be read if coverage.py is installed with the [toml] extra. Coverage.py will raise an error if TOML support is not installed when it sees your settings are in a .toml file. But it didn't understand that [tools.coverage] was a valid section header, so the error wasn't reported if you used that header, and settings were silently ignored. This is now fixed, closing issue 1516_.

    • Fix: adjusted how decorators are traced on PyPy 7.3.10, fixing issue 1515_.

    • Fix: the coverage lcov report did not properly implement the --fail-under=MIN option. This has been fixed.

    • Refactor: added many type annotations, including a number of refactorings. This should not affect outward behavior, but they were a bit invasive in some places, so keep your eyes peeled for oddities.

    • Refactor: removed the vestigial and long untested support for Jython and IronPython.

    .. _issue 1515: nedbat/coveragepy#1515 .. _issue 1516: nedbat/coveragepy#1516 .. _issue 1519: nedbat/coveragepy#1519

    .. _changes_7-0-1:

    Version 7.0.1 — 2022-12-23

    ... (truncated)

    Commits
    • 2ff9098 docs: prep for 7.0.3
    • 1f34d8b fix: race condition on data file shouldn't break combining. #1522
    • 85170bf build: two-step combines for speed
    • 1605f07 mypy: misc.py, test_misc.py
    • 4f3ccf2 refactor: a better way to have maybe-importable third-party modules
    • 98301ed mypy: test_config.py, test_context.py
    • 9d2e1b0 mypy: test_concurrency.py, test_python.py
    • c3ee30c refactor(test): use tmp_path instead of tmpdir
    • 0b05b45 mypy: test_annotate.py test_arcs.py test_collector.py
    • 2090f79 style: better
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Custom m2m field are not handled correctrly

    Custom m2m field are not handled correctrly

    Describe the bug A clear and concise description of what the bug is.

    To Reproduce Steps to reproduce the behavior: Code snippet below illustrates the issue. There are assumptions to the name of the fields in through tables for m2m tables. For the default through tables it works, but for the custom ones it does not.

    If you try to save object of PageArticle you will see:

    django.core.exceptions.FieldError: Cannot resolve keyword 'pagearticle' into field. Choices are: article, article_id, id, tag, tag_id
    
    from django.db import models
    from simple_history.models import HistoricalRecords
    
    class Tag(models.Model):
        name = models.CharField(max_length=100)
    
    class ArticleTag(models.Model):
        article = models.ForeignKey("PageArticle", on_delete=models.CASCADE)
        tag = models.ForeignKey(Tag, on_delete=models.CASCADE)
    
    class PageArticle(models.Model):
        title = models.CharField(max_length=100)
        article_tags = models.ManyToManyField(Tag, through=ArticleTag)
    
        history = HistoricalRecords(m2m_fields=[
            article_tags,
        ])
    

    Expected behavior A model should be saved without any errors.

    Screenshots If applicable, add screenshots to help explain your problem. image

    Environment (please complete the following information):

    • OS: MacOS, Windows
    • Browser (if applicable): [e.g. chrome, safari]
    • Django Simple History Version: 3.2.0
    • Django Version: 4.1.5

    Additional context Pull request that addresses the issue is #1093

    opened by PiotrKurnik 0
  • Proper handling of custom m2m relationships

    Proper handling of custom m2m relationships

    django-simple-history does not work with custom through tables for m2m relations.

    Description

    Code snippet below illustrates the issue. There are assumptions to the name of the fields in through tables for m2m tables. For the default through tables it works, but for the custom ones it does not.

    If you try to save object of PageArticle you will see:

    django.core.exceptions.FieldError: Cannot resolve keyword 'pagearticle' into field. Choices are: article, article_id, id, tag, tag_id
    
    from django.db import models
    from simple_history.models import HistoricalRecords
    
    class Tag(models.Model):
        name = models.CharField(max_length=100)
    
    class ArticleTag(models.Model):
        article = models.ForeignKey("PageArticle", on_delete=models.CASCADE)
        tag = models.ForeignKey(Tag, on_delete=models.CASCADE)
    
    class PageArticle(models.Model):
        title = models.CharField(max_length=100)
        article_tags = models.ManyToManyField(Tag, through=ArticleTag)
    
        history = HistoricalRecords(m2m_fields=[
            article_tags,
        ])
    
    
    

    Related Issue

    #1079

    Motivation and Context

    We need to use model introspection to find the correct field name and not to relate on model name.

    How Has This Been Tested?

    Unit test has been added.

    Screenshots (if appropriate):

    image

    Types of changes

    • [x] Bug fix (non-breaking change which fixes an issue)

    Checklist:

    • [x] I have run the pre-commit run command to format and lint.
    • [ ] My change requires a change to the documentation.
    • [ ] I have updated the documentation accordingly.
    • [x] I have read the CONTRIBUTING document.
    • [x] I have added tests to cover my changes.
    • [x] I have added my name and/or github handle to AUTHORS.rst
    • [x] I have added my change to CHANGES.rst
    • [x] All new and existing tests passed.
    opened by PiotrKurnik 2
  • Bump tox-gh-actions from 2.11.0 to 3.0.0 in /requirements

    Bump tox-gh-actions from 2.11.0 to 3.0.0 in /requirements

    Bumps tox-gh-actions from 2.11.0 to 3.0.0.

    Release notes

    Sourced from tox-gh-actions's releases.

    v3.0.0

    What's Changed

    This is the first stable version which supports tox v4.

    • tox-gh-actions v3.0.0 implements a subset of features provided by the latest tox-gh-actions v2. Missing features will be added back gradually.
    • Users using tox v3 can keep using tox-gh-actions v2 maintained under the tox3 branch.

    Full Changelog: https://github.com/ymyzk/tox-gh-actions/compare/v3.0.0b1...v3.0.0

    v3.0.0b1

    What's Changed

    Full Changelog: https://github.com/ymyzk/tox-gh-actions/compare/v3.0.0a2...v3.0.0b1

    v3.0.0a2

    What's Changed

    Full Changelog: https://github.com/ymyzk/tox-gh-actions/compare/v3.0.0a1...v3.0.0a2

    v3.0.0a1

    • Preliminary support of tox 4. This version is tested with tox 4.0.0a9. (#59)

    v2.12.0

    What's Changed

    Full Changelog: https://github.com/ymyzk/tox-gh-actions/compare/v2.11.0...v2.12.0

    Commits
    • 1602fc1 Fix CI
    • 9f5b430 Preparation for 3.0.0 release
    • c9b535e Tune testing tools
    • 56019d1 Merge pull request #136 from ymyzk/update-dependencies
    • 54c19cd Update dependencies
    • 3def659 Update links to tox's documentation
    • 4722a2e Merge pull request #135 from ymyzk/tox4-ci
    • b4726e9 Remove pypy2 from test suites
    • 866c32a Add devpi-process optional dependency for integration testing
    • e2c010a Clean up workflow for tox4
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump isort from 5.10.1 to 5.11.4 in /requirements

    Bump isort from 5.10.1 to 5.11.4 in /requirements

    Bumps isort from 5.10.1 to 5.11.4.

    Release notes

    Sourced from isort's releases.

    5.11.4

    Changes

    :package: Dependencies

    5.11.3

    Changes

    :beetle: Fixes

    :construction_worker: Continuous Integration

    v5.11.3

    Changes

    :beetle: Fixes

    :construction_worker: Continuous Integration

    5.11.2

    Changes

    5.11.1

    Changes December 12 2022

    ... (truncated)

    Changelog

    Sourced from isort's changelog.

    5.11.4 December 21 2022

    5.11.3 December 16 2022

    5.11.2 December 12 2022

    5.11.1 December 12 2022

    5.11.0 December 12 2022

    Commits
    • 98390f5 Merge pull request #2059 from PyCQA/version/5.11.4
    • df69a05 Bump version 5.11.4
    • f9add58 Merge pull request #2058 from PyCQA/deps/poetry-1.3.1
    • 36caa91 Bump Poetry 1.3.1
    • 3c2e2d0 Merge pull request #1978 from mgorny/toml-test
    • 45d6abd Remove obsolete toml import from the test suite
    • 3020e0b Merge pull request #2057 from mgorny/poetry-install
    • a6fdbfd Stop installing documentation files to top-level site-packages
    • ff306f8 Fix tag template to match old standard
    • 227c4ae Merge pull request #2052 from hugovk/main
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
Releases(3.2.0)
  • 3.2.0(Sep 28, 2022)

    What's Changed

    • Replaces count by exists in populate_history command by @fabiocapsouza in https://github.com/jazzband/django-simple-history/pull/982
    • [issue-983] querying history, convert to instance, chase foreign key on history_date by @jeking3 in https://github.com/jazzband/django-simple-history/pull/984
    • [fix] add fallback_version to scm settings by @areski in https://github.com/jazzband/django-simple-history/pull/981
    • Removed n+1 query from bulk_create_with_history utility by @twolfson in https://github.com/jazzband/django-simple-history/pull/975
    • Fixed simple typos by @creyD in https://github.com/jazzband/django-simple-history/pull/996
    • Fix code block in docs for Using custom OneToOneFields by @bheesham in https://github.com/jazzband/django-simple-history/pull/1011
    • Added support for Django 4.1 by @hramezani in https://github.com/jazzband/django-simple-history/pull/1021
    • Add pyupgrade to .pre-commit-config.yaml by @hramezani in https://github.com/jazzband/django-simple-history/pull/1022
    • Enable diffing m2m fields by @thijskramer in https://github.com/jazzband/django-simple-history/pull/932

    New Contributors

    • @fabiocapsouza made their first contribution in https://github.com/jazzband/django-simple-history/pull/982
    • @twolfson made their first contribution in https://github.com/jazzband/django-simple-history/pull/975
    • @creyD made their first contribution in https://github.com/jazzband/django-simple-history/pull/996
    • @bheesham made their first contribution in https://github.com/jazzband/django-simple-history/pull/1011
    • @thijskramer made their first contribution in https://github.com/jazzband/django-simple-history/pull/932

    Full Changelog: https://github.com/jazzband/django-simple-history/compare/3.1.1...3.2.0

    Source code(tar.gz)
    Source code(zip)
  • 3.1.1(Apr 23, 2022)

    What's Changed

    • Fix stale py36 references in pyproject.toml by @jeking3 in https://github.com/jazzband/django-simple-history/pull/978
    • Fix local setup.py install versioning issue by @jeking3 in https://github.com/jazzband/django-simple-history/pull/978
    • Prepare for 3.1.1 and remove py2 universal wheel by @jeking3 in https://github.com/jazzband/django-simple-history/pull/979

    Full Changelog: https://github.com/jazzband/django-simple-history/compare/3.1.0...3.1.1

    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Apr 23, 2022)

    Breaking Changes

    • Dropped support for Django 2.2 (gh-968)
    • Dropped support for Django 3.1 (gh-952)
    • Dropped support for Python 3.6, which reached end-of-life on 2021-12-23 (gh-946)

    Upgrade Implications

    • Run makemigrations after upgrading to realize the benefit of indexing changes.

    Full list of changes

    • Added queryset-based filtering with as_of (gh-397)
    • Added index on history_date column; opt-out with setting SIMPLE_HISTORY_DATE_INDEX (gh-565)
    • RecordModels now support a no_db_index setting, to drop indices in historical models, default stays the same (gh-720)
    • Support included_fields for history.diff_against (gh-776)
    • Improve performance of history.diff_against by reducing number of queries to 0 in most cases (gh-776)
    • Fixed prev_record and next_record performance when using excluded_fields (gh-791)
    • Fixed update_change_reason in pk (gh-806)
    • Fixed bug where serializer of djangorestframework crashed if used with OrderingFilter (gh-821)
    • Fixed make format so it works by using tox (gh-859)
    • Fixed bug where latest() is not idempotent for identical history_date records (gh-861)
    • Added excluded_field_kwargs to support custom OneToOneField that have additional arguments that don't exist on ForeignKey. (gh-870)
    • Added Czech translations (gh-885)
    • Added ability to break into debugger on unit test failure (gh-890)
    • Added pre-commit for better commit quality (gh-896)
    • Russian translations update (gh-897)
    • Added support for Django 4.0 (gh-898)
    • Added Python 3.10 to test matrix (gh-899)
    • Fix bug with history.diff_against with non-editable fields (gh-923)
    • Added HistoricForeignKey (gh-940)
    • Support change reason formula feature. Change reason formula can be defined by overriding get_change_reason_for_object method after subclassing HistoricalRecords (gh-962)
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Apr 16, 2021)

    Breaking changes:

    • Removed support for Django 3.0
    • Removed changeReason in favor of _change_reason (see 2.10.0)

    Full list of changes:

    • Removed support for Django versions prior to 2.2 (gh-652)
    • Migrate from TravisCI to Github Actions (gh-739)
    • Add Python 3.9 support (gh-745)
    • Support ignore_conflicts in bulk_create_with_history (gh-733)
    • Use asgiref when available instead of thread locals (gh-747)
    • Sort imports with isort (gh-751)
    • Queryset history.as_of speed improvements by calculating in the DB (gh-758)
    • Increase black and isort python version to 3.6 (gh-817)
    • Remove Django 3.0 support (gh-817)
    • Add Django 3.2 support (gh-817)
    • Improve French translations (gh-811)
    • Remove support for changeReason (gh-819)
    Source code(tar.gz)
    Source code(zip)
  • 2.12.0(Oct 14, 2020)

    • Add default date to bulk_create_with_history and bulk_update_with_history (gh-687)
    • Exclude ManyToManyFields when using bulk_create_with_history (gh-699)
    • Added --excluded_fields argument to clean_duplicate_history command (gh-674)
    • Exclude ManyToManyFields when fetching excluded fields (gh-707)
    • Use default model manager for bulk_create_with_history and bulk_update_with_history instead of objects (gh-703)
    • Add optional manager argument to bulk_update_with_history to use instead of the default manager (gh-703)
    • Add support for Django 3.1 (gh-713)
    • Fix a bug with clean_old_history command's --days argument (gh-722)

    * NOTE: This will be the last minor release before 3.0.0.

    Source code(tar.gz)
    Source code(zip)
  • 2.11.0(Jun 20, 2020)

    • Added clean_old_history management command (gh-675)
    • Added user_db_constraint param to history to avoid circular reference on delete (gh-676)
    • Leverages get_user from HistoricalRecords in order to set a fallback user on bulk update and bulk create (gh-677)
    Source code(tar.gz)
    Source code(zip)
  • 2.10.0(Apr 27, 2020)

    • Added bulk_update_with_history utility function (gh-650)
    • Add default user and default change reason to bulk_create_with_history and bulk_update_with_history (gh-653)
    • Add french translation (gh-654)
    • Start using _change_reason instead of changeReason to add change reasons to historical objects. changeReason is deprecated and will be removed in version 3.0.0 (gh-655)
    Source code(tar.gz)
    Source code(zip)
  • 2.9.0(Apr 23, 2020)

    • Add simple filtering if provided a minutes argument in clean_duplicate_history (gh-606)
    • Add setting to convert FileField to CharField instead of TextField (gh-625)
    • Added notes on BitBucket Pipelines (gh-627)
    • import model ContentType in SimpleHistoryAdmin using django_apps.get_model to avoid possible AppRegistryNotReady exception (gh-630)
    • Fix utils.update_change_reason when user specifies excluded_fields (gh-637)
    • Changed how now is imported from timezone (timezone module is imported now) (gh-643)
    • settings.SIMPLE_HISTORY_REVERT_DISABLED if True removes the Revert button from the history form for all historical models (gh-632))
    Source code(tar.gz)
    Source code(zip)
  • 2.8.0(Dec 2, 2019)

    • Fixed bulk_create_with_history support for HistoryRecords with relation_name attribute (gh-591)
    • Added support for bulk_create_with_history for databases different from PostgreSQL (gh-577)
    • Fixed DoesNotExist error when trying to get instance if object is deleted (gh-571)
    • Fix model_to_dict to detect changes in a parent model when using inherit=True (backwards-incompatible for users who were directly using previous version) (gh-576)
    • Use an iterator for clean_duplicate_history (gh-604)
    • Add support for Python 3.8 and Django 3.0 (gh-610)
    Source code(tar.gz)
    Source code(zip)
  • 2.7.3(Jul 16, 2019)

    • Fixed BigAutoField not mirrored as BigInt (gh-556)
    • Fixed most_recent() bug with excluded_fields (gh-561)
    • Added official Django 2.2 support (gh-555)
    Source code(tar.gz)
    Source code(zip)
  • 2.7.2(Apr 17, 2019)

  • 2.7.1(Apr 16, 2019)

    • Added the possibility to create a relation to the original model (gh-536)
    • Fix router backward-compatibility issue with 2.7.0 (gh-539, gh-547)
    • Fix hardcoded history manager (gh-542)
    • Replace deprecated django.utils.six with six (gh-526)
    • Allow custom_model_name parameter to be a callable (gh-489)
    Source code(tar.gz)
    Source code(zip)
  • 2.7.0(Jan 16, 2019)

    • * Add support for using chained manager method and save/delete keyword argument (gh-507)
    • Added management command clean_duplicate_history to remove duplicate history entries (gh-483)
    • Updated most_recent to work with excluded_fields (gh-477)
    • Fixed bug that prevented self-referential foreign key from using 'self' (gh-513)
    • Added ability to track custom user with explicit custom history_user_id_field (gh-511)
    • Don't resolve relationships for history objects (gh-479)
    • Reorganization of docs (gh-510)

    * NOTE: This change was not backward compatible for users using routers to write history tables to a separate database from their base tables. This issue is fixed in 2.7.1.

    Source code(tar.gz)
    Source code(zip)
  • 2.6.0(Dec 12, 2018)

    • Add app parameter to the constructor of HistoricalRecords (gh-486)
    • Add custom_model_name parameter to the constructor of HistoricalRecords (gh-451)
    • Fix header on history pages when custom site_header is used (gh-448)
    • Modify pre_create_historircal_record to pass history_instance for ease of customization (gh-421)
    • Raise warning if HistoricalRecords(inherit=False) is in an abstract model (gh-341)
    • Ensure custom arguments for fields are included in historical models' fields (gh-431)
    • Add german translations (gh-484)
    • Add extra_context parameter to history_form_view (gh-467)
    • Fixed bug that prevented next_record and prev_record to work with custom manager names (gh-501)
    Source code(tar.gz)
    Source code(zip)
  • 2.5.1(Oct 22, 2018)

    • Add '+' as the history_type for each instance in bulk_history_create (gh-449)
    • Add support for history_change_reason for each instance in bulk_history_create (gh-449)
    • Add history_change_reason in the history list view under the Change reason display name (gh-458)
    • Fix bug that caused failures when using a custom user model (gh-459)
    Source code(tar.gz)
    Source code(zip)
  • 2.5.0(Oct 18, 2018)

  • 2.4.0(Oct 18, 2018)

    • Add pre and post create_historical_record signals (gh-426)
    • Remove support for django_mongodb_engine when converting AutoFields (gh-432)
    • Add support for Django 2.1 (gh-418)
    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Jul 19, 2018)

  • 2.2.0(Jul 2, 2018)

    • Add ability to specify alternative user_model for tracking (gh-371)
    • Add util function bulk_create_with_history to allow bulk_create with history saved (gh-412)
    Source code(tar.gz)
    Source code(zip)
  • 2.1.1(Jun 15, 2018)

    • Fixed out-of-memory exception when running populate_history management command (gh-408)
    • Fix TypeError on populate_history if excluded_fields are specified (gh-410)
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Jun 4, 2018)

    • Add ability to specify custom history_reason field (gh-379)
    • Add ability to specify custom history_id field (gh-368)
    • Add HistoricalRecord instance properties prev_record and next_record (gh-365)
    • Can set admin methods as attributes on object history change list template (gh-390)
    • Fixed compatibility of >= 2.0 versions with old-style middleware (gh-369)
    Source code(tar.gz)
    Source code(zip)
  • 2.0(Apr 5, 2018)

    • Added Django 2.0 support (gh-330)
    • Dropped support for Django<=1.10 (gh-356)
    • Fix bug where history_view ignored user permissions (gh-361)
    • Fixed HistoryRequestMiddleware which hadn't been working for Django>1.9 (gh-364)
    Source code(tar.gz)
    Source code(zip)
  • 1.9.1(Apr 3, 2018)

    • Use get_queryset rather than model.objects in history_view. (gh-303)
    • Change ugettext calls in models.py to ugettext_lazy
    • Resolve issue where model references itself (gh-278)
    • Fix issue with tracking an inherited model (abstract class) (gh-269)
    • Fix history detail view on django-admin for abstract models (gh-308)
    • Dropped support for Django<=1.6 and Python 3.3 (gh-292)
    Source code(tar.gz)
    Source code(zip)
  • 1.9.0(Apr 3, 2018)

    • Add –batchsize option to the populate_history management command. (gh-231)
    • Add ability to show specific attributes in admin history list view. (gh-256)
    • Add Brazilian Portuguese translation file. (gh-279)
    • Fix locale file packaging issue. (gh-280)
    • Add ability to specify reason for history change. (gh-275)
    • Test against Django 1.11 and Python 3.6. (gh-276)
    • Add excluded_fields option to exclude fields from history. (gh-274)
    Source code(tar.gz)
    Source code(zip)
PEP-484 stubs for Django

pep484 stubs for Django This package contains type stubs and a custom mypy plugin to provide more precise static types and type inference for Django f

TypedDjango 1.1k Dec 30, 2022
Django admin CKEditor integration.

Django CKEditor NOTICE: django-ckeditor 5 has backward incompatible code moves against 4.5.1. File upload support has been moved to ckeditor_uploader.

2.2k Jan 02, 2023
PostgreSQL with Docker + Portainer + pgAdmin + Django local

django-postgresql-docker Running PostgreSQL with Docker + Portainer + pgAdmin + Django local for development. This project was done with: Python 3.9.8

Regis Santos 4 Jun 12, 2022
pdm-django: Django command shortcuts for PDM

pdm-django: Django command shortcuts for PDM A plugin that gives you command shortcuts for developing with PDM. pdm run python manage.py runserver -

Neutron Sync 2 Aug 11, 2022
Source code for Django for Beginners 3.2

The official source code for https://djangoforbeginners.com/. Available as an ebook or in Paperback. If you have the 3.1 version, please refer to this

William Vincent 10 Jan 03, 2023
Custom Django field for using enumerations of named constants

django-enumfield Provides an enumeration Django model field (using IntegerField) with reusable enums and transition validation. Installation Currently

5 Monkeys 195 Dec 20, 2022
Use watchfiles in Django’s autoreloader.

django-watchfiles Use watchfiles in Django’s autoreloader. Requirements Python 3.7 to 3.10 supported. Django 2.2 to 4.0 supported. Installation Instal

Adam Johnson 43 Dec 14, 2022
Bootstrap 4 integration with Django.

django-bootstrap 4 Bootstrap 4 integration for Django. Goal The goal of this project is to seamlessly blend Django and Bootstrap 4. Requirements Pytho

Zostera B.V. 980 Dec 29, 2022
Highlight the keywords of a page if a visitor is coming from a search engine.

Django-SEKH Django Search Engine Keywords Highlighter, is a middleware for Django providing the capacities to highlight the user's search keywords if

Julien Fache 24 Oct 08, 2021
Management commands to help backup and restore your project database and media files

Django Database Backup This Django application provides management commands to help backup and restore your project database and media files with vari

687 Jan 04, 2023
Django Pickled Model

Django Pickled Model Django pickled model provides you a model with dynamic data types. a field can store any value in any type. You can store Integer

Amir 3 Sep 14, 2022
Median and percentile for Django and MongoEngine

Tailslide Median and percentile for Django and MongoEngine Supports: PostgreSQL SQLite MariaDB MySQL (with an extension) SQL Server MongoDB 🔥 Uses na

Andrew Kane 4 Jan 15, 2022
Duckiter will Automatically dockerize your Django projects.

Duckiter Duckiter will Automatically dockerize your Django projects. Requirements : - python version : python version 3.6 or upper version - OS :

soroush safari 23 Sep 16, 2021
An example of Django project with basic user functionality and account activation.

Simple Django Login and Registration An example of Django project with basic user functionality. Screenshots Log In Create an account Authorized page

Hussein Sarea 3 Oct 19, 2022
Utilities for implementing a modified pre-order traversal tree in django.

django-mptt Utilities for implementing Modified Preorder Tree Traversal with your Django Models and working with trees of Model instances. Project hom

2.7k Jan 01, 2023
📊📈 Serves up Pandas dataframes via the Django REST Framework for use in client-side (i.e. d3.js) visualizations and offline analysis (e.g. Excel)

Django REST Pandas Django REST Framework + pandas = A Model-driven Visualization API Django REST Pandas (DRP) provides a simple way to generate and se

wq framework 1.2k Jan 01, 2023
GameStop clone with Django

GameStop clone with Django This is my side project with GameStop clone Author: HackerApe GitHub Profile: View Profile LinkedIn Profile: View Profile

Dmitriy Shin 2 Dec 26, 2021
Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

Super simple bar charts for django admin list views visualizing the number of objects based on date_hierarchy using Chart.js.

foorilla LLC 4 May 18, 2022
Utilities to make function-based views cleaner, more efficient, and better tasting.

django-fbv Utilities to make Django function-based views cleaner, more efficient, and better tasting. 💥 📖 Complete documentation: https://django-fbv

Adam Hill 49 Dec 30, 2022
Sistema de tratamento e análise de grandes volumes de dados através de técnicas de Data Science

Sistema de tratamento e análise de grandes volumes de dados através de técnicas de data science Todos os scripts, gráficos e relatórios de todas as at

Arthur Quintanilha Neto 1 Sep 05, 2022