Skip to content

Commit 7aa9095

Browse files
committed
Update docs
1 parent 08e7066 commit 7aa9095

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

docs/introduction/versioning_integration.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,18 @@ Whilst simple model structures should be fine using the `default_copy` function,
163163
you will most likely need to implement a custom copy function if your :term:`content model <content model>`
164164
does any of the following:
165165

166-
- Contains any one2one or m2m fields.
167-
- Contains a generic foreign key.
168-
- Contains a foreign key that relates to an
169-
object that should be considered part of the version. For example
170-
if you're versioning a poll object, you might consider the answers
171-
in the poll as part of a version. If so, you will need to copy
172-
the answer objects, not just the poll object. On the other hand if
173-
a poll has an fk to a category model, you probably wouldn't consider
174-
category as part of the version. In this case the default copy function
175-
will take care of this.
176-
- Other models have reverse relationships to your content model and
177-
should be considered part of the version
166+
- Contains any one2one or m2m fields (except one2one relationships through django CMS' :clas:``cms.extensions.models.BaseExtension``).
167+
- Contains a generic foreign key
168+
- Contains a foreign key that relates to an
169+
object that should be considered part of the version. For example
170+
if you're versioning a poll object, you might consider the answers
171+
in the poll as part of a version. If so, you will need to copy
172+
the answer objects, not just the poll object. On the other hand if
173+
a poll has an fk to a category model, you probably wouldn't consider
174+
category as part of the version. In this case the default copy function
175+
will take care of this.
176+
- Other models have reverse relationships to your content model and
177+
should be considered part of the version
178178

179179
So let's get back to our example and complicate the model structure a little. Let's say our
180180
`blog` app supports the use of polls in posts and also our posts can be categorized.
@@ -215,11 +215,11 @@ Now our `blog/models.py` now looks like this:
215215
If we were using the `default_copy` function on this model structure, versioning wouldn't necessarily do what you expect.
216216
Let's take a scenario like this:
217217

218-
1. A Post object has 2 versions - `version #1` which is archived and `version #2` which is published.
219-
2. We revert to `version #1` which creates a draft `version #3`.
220-
3. The PostContent data in `version #3` is a copy of what was in `version #1` (the version we reverted to), but the Poll and Answer data is what was there at the time of `version #2` (the latest version).
221-
4. We edit both the PostContent, Poll and Answer data on `version #3`.
222-
5. The PostContent data is now different in all three versions. However, the poll data is the same in all three versions. This means that the data edit we did on `version #3` (a draft) to Poll and Answer objects is now being displayed on the published site (`version #2` is published).
218+
1. A Post object has 2 versions - `version #1` which is archived and `version #2` which is published.
219+
2. We revert to `version #1` which creates a draft `version #3`.
220+
3. The PostContent data in `version #3` is a copy of what was in `version #1` (the version we reverted to), but the Poll and Answer data is what was there at the time of `version #2` (the latest version).
221+
4. We edit both the PostContent, Poll and Answer data on `version #3`.
222+
5. The PostContent data is now different in all three versions. However, the poll data is the same in all three versions. This means that the data edit we did on `version #3` (a draft) to Poll and Answer objects is now being displayed on the published site (`version #2` is published).
223223

224224
This is probably not how one would want things to work in this scenario, so to fix it, we need to implement a custom :term:`copy function <copy function>` like so:
225225

0 commit comments

Comments
 (0)