This repository has been archived by the owner on Jun 23, 2020. It is now read-only.
forked from bmedx/django-simple-history
-
Notifications
You must be signed in to change notification settings - Fork 1
WIP: Add default many-to-many support #1
Open
bmedx
wants to merge
9
commits into
master
Choose a base branch
from
bmedx/add_m2m_support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Custom through models may not work correctly - Currently storing IDs for FKs, probably needs replacing
bmedx
commented
Jan 29, 2020
bmedx
commented
Jan 29, 2020
- Py3.4 removed as coverage no longer supports it, could be pinned instead, but I went with this.
I had a question: I am using the AdminModel, how do I see the m2m field corresponding to a historical object on the change object screen. I am using it as a non-admin user (though I have admin access too). Any historical object chosen from the admin list display screen still shows the most recent m2m values on the screen (showing details of a single object). On the list display screen I was however able to see historical m2m values by looking at the HistoricalXYZ object. Doesn't the admin.py:history_form_view() also need a change ? |
11 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work in progress. Needs code cleanup, documentation added, and further testing (especially in the admin site) but seems to work as expected.
Adds support for Django's default many-to-many models (ones without explicit an
through
)Description
Allows m2m fields to be explicitly added to the history of a model which uses
HistoricalRecords
. It allows access to the m2m history via ahistorical_{m2m_field_name}
attribute.When the parent model adds a history row, all connected m2m fields store all existing connections with a FK back to the history row. When the m2m mapping is updated (
add
,remove
,clear
) a new history row is created, firing off the same process.Related Issue
jazzband#399
jazzband#370
jazzband#16
Motivation and Context
We need to track changes in many-to-many relationships over time.
How Has This Been Tested?
Added unit tests to cover everything I could think of.
Types of changes
Checklist:
make format
command to format my codeAUTHORS.rst
CHANGES.rst