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

Don't populate excluded fields in populate history #410

Merged

Conversation

rossmechanic
Copy link
Collaborator

Description

Rebases #381 in order to get it merged for 2.1.1 release. Fixes error when trying to bulk_create history with excluded fields that occurs when running populate_history management command. Closes #402. Thanks @uadnan for this fix.

Related Issue

#402

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:

  • My code follows the code style of this project.
  • 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.
  • All new and existing tests passed.

uadnan and others added 9 commits June 14, 2018 22:44
- tests the management command on an historical record which has excluded fields
- tests the excluded fields are retrieved from the current model instance
Previously, it was pre-loading directly related objects.
excluded_fields -> _history_excluded_fields
update_record -> initial_history_record
@codecov-io
Copy link

codecov-io commented Jun 15, 2018

Codecov Report

Merging #410 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #410      +/-   ##
==========================================
+ Coverage   97.14%   97.16%   +0.02%     
==========================================
  Files          14       14              
  Lines         630      635       +5     
  Branches       87       89       +2     
==========================================
+ Hits          612      617       +5     
  Misses          9        9              
  Partials        9        9
Impacted Files Coverage Δ
simple_history/manager.py 96.82% <ø> (ø) ⬆️
simple_history/models.py 98.59% <100%> (+0.03%) ⬆️

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 ad523eb...b709c53. Read the comment docs.

Copy link
Collaborator

@kseever kseever left a comment

Choose a reason for hiding this comment

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

Looks about right

@rossmechanic rossmechanic merged commit a3b86f1 into master Jun 15, 2018
@rossmechanic rossmechanic deleted the dont-populate-excluded-fields-in-populate-history branch June 15, 2018 16:27
with self.assertRaises(AttributeError):
historical.place

def test_nb_queries(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you want to test the number of DB queries?

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.

Problem to use history = HistoricalRecords(excluded_fields=['description'])
6 participants