Description
Summary
I'm trying to run the migrations on a site that has two Page trees; one for the Dutch version and one for the Belgium version. We started the project with only a Dutch version and at some point we made a copy (using the "cms copy" management command) of this so that the BE editors could edit the page tree.
We use two page trees here because the .be version of our website has different content than the Dutch version, so using a translation didn't fit our requirements.
After updating to 3.5 we can't run the migrations.
Expected behaviour
I expected the migrations to run :)
Actual behaviour
The migrations fail at cms.0017_pagetype because of:
__fake__.MultipleObjectsReturned: get() returned more than one Page -- it returned 2!
6E99
p>
This seems to be related to this line: https://github.com/divio/django-cms/blob/fd5956bef4b74b0a8c144c2ecde74fdae67756a7/cms/migrations/0017_pagetype.py#L21 in the migrations.
When I run the query on our DB I see that we do have two of these objects:
>>> for i in Page.objects.filter(reverse_id='page_types', publisher_is_draft=True):
... print(i.pk)
... print(i.site)
...
838
www.<site name>.nl
1515
www.<site name>.be
>>> for i in Page.objects.filter(reverse_id='page_types'):
... print(i.site)
... print(i.pk)
...
www.<site name>.nl
838
www.<site name>.nl
952
www.<site name>.be
1515
www.<site name>.be
1797
I couldn't find any information on what page_types is supposed to do. Can we safely delete this? If so, it might be worth adding this to the release notes :)
If not, it might be worth changing the migration to iterate over these objects instead of running a .get.
Thanks!
Environment
- Python version: 3.6
- Django version: 1.11
- django CMS version: 3.5