Implementation¶
We were trying to solve the page version history topic with a simple and pragmatic fix. The old branch of this repository still contains our reversion2 with the json backend, but that had some structural problems. And we had some new requirements:
Motivation¶
- Working on multiple drafts simultaneously
- Not loosing constraints (any model connected to a plugin was a potential insecurity with the old backend)
- Performance (serialization and de-serialization comes with performance cost) -> we prefer database cost
- Avoiding the registration logic of the reversion backend for every models.py
Idea¶
- When the user creates a new version of a page the draft is copied to a hidden root node in the page tree
- This so called
hidden_page
is linked to thePageVersion
model that keeps a reference to thevisible draft
- There is always a PageVersion with the attribute
primary draft
- The PageVersion is language specific so a rollback doesn’t affect the translations of a page
- The PageVersions are organized in an independent MP_Tree so they are chainable. This feature allows us to implement branching in a future step