Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Editing a page sometimes fails #7876

Open
1 of 2 tasks
jrief opened this issue Apr 17, 2024 · 1 comment
Open
1 of 2 tasks

[BUG] Editing a page sometimes fails #7876

jrief opened this issue Apr 17, 2024 · 1 comment

Comments

@jrief
Copy link
Contributor

jrief commented Apr 17, 2024

Description

In very special occasions, attempting to edit a page results in a database integrity error. This is caused by a Placeholder-object holding plugins in different languages. In our project we have 3 placeholders (out of 83k) where placeholder.cmsplugin_set.all() delivers plugins in German as well as in English.

This presumably is a data inconsistency, but I'm unsure of it.

Steps to reproduce

  • Open that special page (a page with a placeholder holding plugins in different languages) – unable to reproduce this in the first place.
  • Click on the button named "New page content".

This raises the following exception:

IntegrityError at /en/admin/djangocms_versioning/pagecontentversion/4562/edit-redirect/
duplicate key value violates unique constraint "cms_cmsplugin_placeholder_id_language_position_bad60ebe_uniq"
DETAIL:  Key (placeholder_id, language, "position")=(213316, de, 2) already exists.

Additional information (CMS/Python/Django versions)

Happens in Django-CMS 4.1

Do you want to help fix this issue?

In order to prevent this, we could change this line:

https://github.com/django-cms/djangocms-versioning/blob/f726bc203c06ccbb8ba79dc9defb98d1b4e06a9d/djangocms_versioning/cms_config.py#L216

to

placeholder.copy_plugins(new_placeholder, language=placeholder.source.language)

but this just fixes the symptoms but not the root cause.

Instead, I wrote a small script to reduce the contents of those 3 placeholders to just their proper language.

  • Yes, I want to help fix this issue and I will join #workgroup-pr-review on Slack to confirm with the community that a PR is welcome.
  • No, I only want to report the issue.
@fsbraun
Copy link
Sponsor Member

fsbraun commented Apr 18, 2024

It might be possible that this is the aftermath of another bug: #7841.

Hard to tell, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants