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

Make skip_history_when_saving work when creating a new object #1262

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

ddabble
Copy link
Member

@ddabble ddabble commented Sep 26, 2023

Description

skip_history_when_saving used to only apply when updating an existing object (due to the not created operand in post_save()), not when creating a new one. This PR fixes that.

Also improved the docs on saving without creating historical records.

Related Issue

Closes #1141.

Motivation and Context

Fixing the linked issue.

How Has This Been Tested?

See the test added in test_models.py.

Screenshots (if appropriate):

Types of changes

  • 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:

  • 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.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have added my name and/or github handle to AUTHORS.rst
  • I have added my change to CHANGES.rst
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.87%. Comparing base (560f298) to head (54fcd0b).
Report is 10 commits behind head on master.

Current head 54fcd0b differs from pull request most recent head 9df1bc3

Please upload reports for the commit 9df1bc3 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1262      +/-   ##
==========================================
+ Coverage   96.84%   96.87%   +0.02%     
==========================================
  Files          24       23       -1     
  Lines        1457     1278     -179     
  Branches      240      211      -29     
==========================================
- Hits         1411     1238     -173     
+ Misses         25       21       -4     
+ Partials       21       19       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ddabble ddabble force-pushed the feature/skip-history-when-creating branch from bf22f55 to 54fcd0b Compare February 19, 2024 22:52
@ddabble ddabble requested review from valberg and theryanwalker and removed request for valberg February 19, 2024 23:06
@ddabble ddabble force-pushed the feature/skip-history-when-creating branch from 54fcd0b to a1f85a9 Compare June 6, 2024 18:34
...a model object - not just when updating an object.

Also improved the docs on saving without creating historical records,
and fixed an unrelated `PollWithManyToMany` instance being used in the
assertions in the existing test for `skip_history_when_saving`.
@ddabble ddabble force-pushed the feature/skip-history-when-creating branch from a1f85a9 to 3c2319c Compare June 6, 2024 20:50
Copy link
Contributor

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

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

If you disagree with my review, I could be convinced to leave things as is.

docs/querying_history.rst Outdated Show resolved Hide resolved
docs/querying_history.rst Outdated Show resolved Hide resolved
docs/querying_history.rst Outdated Show resolved Hide resolved
docs/querying_history.rst Show resolved Hide resolved
docs/querying_history.rst Outdated Show resolved Hide resolved
simple_history/models.py Outdated Show resolved Hide resolved
Copy link
Contributor

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

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

🚀

@ddabble ddabble merged commit 08b4de7 into jazzband:master Jun 7, 2024
17 checks passed
@ddabble ddabble deleted the feature/skip-history-when-creating branch June 7, 2024 21:34
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.

skip_history_when_saving does not work as expected
2 participants