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

Base manager can now be used for clean_duplicate_history #804

Closed
wants to merge 3 commits into from
Closed

Conversation

nick-traeger
Copy link
Contributor

@nick-traeger nick-traeger commented Mar 5, 2021

Description

clean_duplicate_history uses objects as manager. This has now been changed to _default_manager and an option added to use _base_mananger.

Related Issue

none

Motivation and Context

We use a manager to filter records by default, however we want to remove all records from duplicates.

How Has This Been Tested?

The command was first run without parameters and then with the new --base-manager parameter.

Screenshots (if appropriate):

none

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 make format command to format my code
  • 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 Mar 5, 2021

Codecov Report

Merging #804 (f77b59f) into master (0de0649) will increase coverage by 0.40%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #804      +/-   ##
==========================================
+ Coverage   97.47%   97.88%   +0.40%     
==========================================
  Files          18       18              
  Lines         992      992              
  Branches      151      151              
==========================================
+ Hits          967      971       +4     
+ Misses         12        9       -3     
+ Partials       13       12       -1     
Impacted Files Coverage Δ
simple_history/registry_tests/tests.py 95.87% <ø> (ø)
...ory/management/commands/clean_duplicate_history.py 97.36% <100.00%> (+0.14%) ⬆️
simple_history/utils.py 100.00% <0.00%> (+6.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0de0649...f77b59f. Read the comment docs.

@barm
Copy link
Collaborator

barm commented Apr 16, 2021

Would you mind adding tests in simple_history/tests/tests/test_commands.py to make sure both code branches have coverage?

@nick-traeger
Copy link
Contributor Author

Test added

@JackAtOmenApps
Copy link

@nick-traeger This is looking like a nice contribution for folks who use custom managers to filter their models' queries.

Would you go through the checklist (from your initial comment) and make sure you've completed the necessary items? Most are already complete or very minor updates. I checked off a couple for you that are clearly already done.

Also, would you mind adding a short note about usage of the new option in the Utils docs page?

@jeking3
Copy link
Contributor

jeking3 commented Sep 17, 2021

@nick-traeger this needs to be rebased.

1 similar comment
@jeking3
Copy link
Contributor

jeking3 commented Oct 25, 2021

@nick-traeger this needs to be rebased.

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.

clean_duplicate_history uses default model manager, which may filter out relevant instances
4 participants