Version numbers and relations (Should object version increase when its relations change?)
See original GitHub issueI have a problem with the following use-case:
My Article
has one-to-many to Tag
. The end-user application only considers the Article history state (so the fact that Tags have state too is invisible), and is able to revert or see all snapshots of the Article history. The Article state is considered to be changed when the article itself is changed, when tags are added/removed and when one of its existing tags is modified.
How can I go back to all Article history (and by that I want to include snapshots where only the Tags of the article were modified, not necessarily the article column’s)? The revert(relations=['Tags']
produces very unexpected results based on the number of the Article versions and the number of each Tag’s versions.
If one of my tags has more versions that the article for example, there is no way to use article.revert(relations=['Tags'])
to go back to all states of that tag. How can I achieve this?
It would be nice to have an option like increment_version_on_relation_change
.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top GitHub Comments
I hacked a naive plugin that adds related by foreign key objects into the current versioning transaction. The code is not tested and probably contain bugs. It also probably contains assumptions that are only true in my models. There are no unit tests.
https://gist.github.com/grakic/66006440ed871c8b9d73a2206dff8a5e
From some simple playing in the shell, it looks like it is working. I will keep working on this as time permits.
@grakic plugin works great with some changes to fit our code