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

Can’t publish some PNI products #7356

Closed
TheoChevalier opened this issue Sep 10, 2021 · 4 comments · Fixed by #7403
Closed

Can’t publish some PNI products #7356

TheoChevalier opened this issue Sep 10, 2021 · 4 comments · Fixed by #7403
Assignees

Comments

@TheoChevalier
Copy link
Contributor

TheoChevalier commented Sep 10, 2021

Trying to publish this draft in order to generate a .po file, it crashes with the following:

2021-09-10T16:35:03.390276+00:00 heroku[router]: at=info method=POST path="/cms/pages/12512/edit/" host=foundation.mofostaging.net request_id=d2d8f8b2-2ea5-43df-90a3-0012b7c7c3c8 fwd="109.220.236.90" dyno=web.1 connect=0ms service=2009ms status=500 bytes=2162 protocol=https

2021-09-10T16:35:03.365826+00:00 app[web.1]: Internal Server Error: /cms/pages/12512/edit/

2021-09-10T16:35:03.365836+00:00 app[web.1]: Traceback (most recent call last):

2021-09-10T16:35:03.365837+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute

2021-09-10T16:35:03.365837+00:00 app[web.1]:     return self.cursor.execute(sql, params)

2021-09-10T16:35:03.365852+00:00 app[web.1]: psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "wagtailpages_productpage_translation_key_locale_i_5c988681_uniq"

2021-09-10T16:35:03.365853+00:00 app[web.1]: DETAIL:  Key (translation_key, locale_id)=(1bc747eb-f088-430d-9158-b489ad6eb9ba, 7) already exists.

2021-09-10T16:35:03.365853+00:00 app[web.1]: 

2021-09-10T16:35:03.365853+00:00 app[web.1]: 

2021-09-10T16:35:03.365854+00:00 app[web.1]: The above exception was the direct cause of the following exception:

2021-09-10T16:35:03.365854+00:00 app[web.1]: 

2021-09-10T16:35:03.365855+00:00 app[web.1]: Traceback (most recent call last):

2021-09-10T16:35:03.365855+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner

2021-09-10T16:35:03.365855+00:00 app[web.1]:     response = get_response(request)

2021-09-10T16:35:03.365862+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response

2021-09-10T16:35:03.365862+00:00 app[web.1]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)

2021-09-10T16:35:03.365869+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/sentry_sdk/integrations/django/views.py", line 67, in sentry_wrapped_callback

2021-09-10T16:35:03.365869+00:00 app[web.1]:     return callback(request, *args, **kwargs)

2021-09-10T16:35:03.365870+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/contextlib.py", line 74, in inner

2021-09-10T16:35:03.365870+00:00 app[web.1]:     return func(*args, **kwds)

2021-09-10T16:35:03.365871+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func

2021-09-10T16:35:03.365871+00:00 app[web.1]:     response = view_func(request, *args, **kwargs)

2021-09-10T16:35:03.365871+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/admin/urls/__init__.py", line 108, in wrapper

2021-09-10T16:35:03.365872+00:00 app[web.1]:     return view_func(request, *args, **kwargs)

2021-09-10T16:35:03.365872+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/admin/auth.py", line 172, in decorated_view

2021-09-10T16:35:03.365872+00:00 app[web.1]:     response = view_func(request, *args, **kwargs)

2021-09-10T16:35:03.365873+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/views/generic/base.py", line 70, in view

2021-09-10T16:35:03.365873+00:00 app[web.1]:     return self.dispatch(request, *args, **kwargs)

2021-09-10T16:35:03.365873+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 224, in dispatch

2021-09-10T16:35:03.365874+00:00 app[web.1]:     return super().dispatch(request)

2021-09-10T16:35:03.365874+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/views/generic/base.py", line 98, in dispatch

2021-09-10T16:35:03.365874+00:00 app[web.1]:     return handler(request, *args, **kwargs)

2021-09-10T16:35:03.365875+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 311, in post

2021-09-10T16:35:03.365875+00:00 app[web.1]:     return self.form_valid(self.form)

2021-09-10T16:35:03.365875+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 331, in form_valid

2021-09-10T16:35:03.365876+00:00 app[web.1]:     return self.publish_action()

2021-09-10T16:35:03.365876+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 386, in publish_action

2021-09-10T16:35:03.365876+00:00 app[web.1]:     previous_revision=(self.previous_revision if self.is_reverting else None)

2021-09-10T16:35:03.365876+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/core/models.py", line 3102, in publish

2021-09-10T16:35:03.365877+00:00 app[web.1]:     page.update_aliases(revision=self, user=user, _content_json=self.content_json)

2021-09-10T16:35:03.365877+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/core/models.py", line 1573, in update_aliases

2021-09-10T16:35:03.365877+00:00 app[web.1]:     alias_updated.save(clean=False)

2021-09-10T16:35:03.365877+00:00 app[web.1]:   File "/app/network-api/networkapi/wagtailpages/pagemodels/products.py", line 909, in save

2021-09-10T16:35:03.365878+00:00 app[web.1]:     save = super().save(*args, **kwargs)

2021-09-10T16:35:03.365878+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail_airtable/mixins.py", line 312, in save

2021-09-10T16:35:03.365878+00:00 app[web.1]:     saved_model = super().save(*args, **kwargs) # Save to database first so we get pk, in case it's used for uniqueness

2021-09-10T16:35:03.365879+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/contextlib.py", line 74, in inner

2021-09-10T16:35:03.365879+00:00 app[web.1]:     return func(*args, **kwds)

2021-09-10T16:35:03.365879+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/wagtail/core/models.py", line 1052, in save

2021-09-10T16:35:03.365879+00:00 app[web.1]:     result = super().save(**kwargs)

2021-09-10T16:35:03.365879+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/modelcluster/models.py", line 199, in save

2021-09-10T16:35:03.365880+00:00 app[web.1]:     getattr(self, relation).commit()

2021-09-10T16:35:03.365880+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/modelcluster/fields.py", line 210, in commit

2021-09-10T16:35:03.365880+00:00 app[web.1]:     original_manager.add(item, bulk=False)

2021-09-10T16:35:03.365880+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 671, in add

2021-09-10T16:35:03.365881+00:00 app[web.1]:     obj.save()

2021-09-10T16:35:03.365886+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 754, in save

2021-09-10T16:35:03.365887+00:00 app[web.1]:     force_update=force_update, update_fields=update_fields)

2021-09-10T16:35:03.365887+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 792, in save_base

2021-09-10T16:35:03.365887+00:00 app[web.1]:     force_update, using, update_fields,

2021-09-10T16:35:03.365888+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 895, in _save_table

2021-09-10T16:35:03.365888+00:00 app[web.1]:     results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)

2021-09-10T16:35:03.365889+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 935, in _do_insert

2021-09-10T16:35:03.365889+00:00 app[web.1]:     using=using, raw=raw,

2021-09-10T16:35:03.365889+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method

2021-09-10T16:35:03.365889+00:00 app[web.1]:     return getattr(self.get_queryset(), name)(*args, **kwargs)

2021-09-10T16:35:03.365890+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/query.py", line 1254, in _insert

2021-09-10T16:35:03.365890+00:00 app[web.1]:     return query.get_compiler(using=using).execute_sql(returning_fields)

2021-09-10T16:35:03.365890+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql

2021-09-10T16:35:03.365891+00:00 app[web.1]:     cursor.execute(sql, params)

2021-09-10T16:35:03.365891+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/sentry_sdk/integrations/django/__init__.py", line 500, in execute

2021-09-10T16:35:03.365891+00:00 app[web.1]:     return real_execute(self, sql, params)

2021-09-10T16:35:03.365891+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 66, in execute

2021-09-10T16:35:03.365892+00:00 app[web.1]:     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

2021-09-10T16:35:03.365892+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers

2021-09-10T16:35:03.365892+00:00 app[web.1]:     return executor(sql, params, many, context)

2021-09-10T16:35:03.365892+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/scout_apm/django/instruments/sql.py", line 59, in db_execute_hook

2021-09-10T16:35:03.365893+00:00 app[web.1]:     return execute(sql, params, many, context)

2021-09-10T16:35:03.365893+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute

2021-09-10T16:35:03.365893+00:00 app[web.1]:     return self.cursor.execute(sql, params)

2021-09-10T16:35:03.365894+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__

2021-09-10T16:35:03.365894+00:00 app[web.1]:     raise dj_exc_value.with_traceback(traceback) from exc_value

2021-09-10T16:35:03.365894+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute

2021-09-10T16:35:03.365894+00:00 app[web.1]:     return self.cursor.execute(sql, params)

2021-09-10T16:35:03.365895+00:00 app[web.1]: django.db.utils.IntegrityError: duplicate key value violates unique constraint "wagtailpages_productpage_translation_key_locale_i_5c988681_uniq"

2021-09-10T16:35:03.365895+00:00 app[web.1]: DETAIL:  Key (translation_key, locale_id)=(1bc747eb-f088-430d-9158-b489ad6eb9ba, 7) already exists.

2021-09-10T16:35:03.365895+00:00 app[web.1]: 

This is the log from staging (was able to reproduce with https://foundation.mofostaging.net/cms/pages/12512/edit/ )

@benhohner
Copy link
Contributor

benhohner commented Sep 13, 2021

Hey @TheoChevalier, can you please drop any details you discover in the issue?

@TheoChevalier
Copy link
Contributor Author

Thanks to Karl’s help, it looks like we’re hitting wagtail/wagtail-localize#346

This should be solvable by using BootstrapTranslatableMixin on the ProductPageCategory snippet (and likely other snippets used in product pages) as documented on https://docs.wagtail.io/en/stable/advanced_topics/i18n.html#making-snippets-with-existing-data-translatable

@Pomax
Copy link
Contributor

Pomax commented Sep 14, 2021

I tried the solution outlined in the docs on a local copy of our production data

  1. updated the classes that were marked @register_snippet with class signature (TranslatableMixin, LocalizedSnippet, models.Model) to use (BootstrapTranslatableMixin, LocalizedSnippet, models.Model), including their Meta classes to use BootstrapTranslatableMixin.Meta (These were wagtailpages.BuyersGuideProductCategory and wagtailpages.Update, both found in networkapi/network-api/wagtailpages/pagemodels/products.py),

  2. ran inv makemigrations, which yields:

operations = [
        migrations.AlterField(
            model_name='buyersguideproductcategory',
            name='locale',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale'),
        ),
        migrations.AlterField(
            model_name='buyersguideproductcategory',
            name='translation_key',
            field=models.UUIDField(editable=False, null=True),
        ),
        migrations.AlterUniqueTogether(
            name='buyersguideproductcategory',
            unique_together=set(),
        ),
        migrations.AlterField(
            model_name='update',
            name='locale',
            field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale'),
        ),
        migrations.AlterField(
            model_name='update',
            name='translation_key',
            field=models.UUIDField(editable=False, null=True),
        ),
        migrations.AlterUniqueTogether(
            name='update',
            unique_together=set(),
        ),
    ]
  1. created an empty migration by running inv manage "makemigrations wagtailpages --empty" and added the BootstrapTranslatableModel operations for the changed models:
from django.db import migrations
from wagtail.core.models import BootstrapTranslatableModel

class Migration(migrations.Migration):

    dependencies = [
        ('wagtailpages', '0035_bootstrap_translatable_snippets'),
    ]

    operations = [
        BootstrapTranslatableModel('wagtailpages.BuyersGuideProductCategory'),
        BootstrapTranslatableModel('wagtailpages.Update'),
    ]
  1. updated the classes back to using TranslatableMixin,

  2. ran makemigrations again. When prompted to select a fix for the nullable field ‘locale’ being changed to non-nullable, I selected the option “Ignore for now” as per the docs. This yields:

    operations = [
        migrations.AlterField(
            model_name='buyersguideproductcategory',
            name='locale',
            field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale'),
        ),
        migrations.AlterField(
            model_name='buyersguideproductcategory',
            name='translation_key',
            field=models.UUIDField(default=uuid.uuid4, editable=False),
        ),
        migrations.AlterField(
            model_name='update',
            name='locale',
            field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale'),
        ),
        migrations.AlterField(
            model_name='update',
            name='translation_key',
            field=models.UUIDField(default=uuid.uuid4, editable=False),
        ),
        migrations.AlterUniqueTogether(
            name='buyersguideproductcategory',
            unique_together={('translation_key', 'locale')},
        ),
        migrations.AlterUniqueTogether(
            name='update',
            unique_together={('translation_key', 'locale')},
        ),
    ]
  1. ran inv migrate, which applies migrations without any issues,

  2. ran docker-compose up and tried to publish http://localhost:8000/cms/pages/12512/edit/, but the original problem is still there. Trying to publish yields the follow error:

backend_1             | Internal Server Error: /cms/pages/12512/edit/
backend_1             | Traceback (most recent call last):
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute    
backend_1             |     return self.cursor.execute(sql, params)
backend_1             | psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "wagtailpages_productpage_translation_key_locale_i_5c988681_uniq"
backend_1             | DETAIL:  Key (translation_key, locale_id)=(1bc747eb-f088-430d-9158-b489ad6eb9ba, 7) already exists.
backend_1             |
backend_1             |
backend_1             | The above exception was the direct cause of the following exception:
backend_1             |
backend_1             | Traceback (most recent call last):
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner 
backend_1             |     response = get_response(request)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
backend_1             |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
backend_1             |   File "/usr/local/lib/python3.7/contextlib.py", line 74, in inner
backend_1             |     return func(*args, **kwds)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
backend_1             |     response = view_func(request, *args, **kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/admin/urls/__init__.py", line 108, in wrapper 
backend_1             |     return view_func(request, *args, **kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/admin/auth.py", line 193, in decorated_view   
backend_1             |     return view_func(request, *args, **kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/views/generic/base.py", line 70, in view       
backend_1             |     return self.dispatch(request, *args, **kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 224, in dispatch
backend_1             |     return super().dispatch(request)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/views/generic/base.py", line 98, in dispatch   
backend_1             |     return handler(request, *args, **kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 311, in post 
backend_1             |     return self.form_valid(self.form)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 331, in form_valid
backend_1             |     return self.publish_action()
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/admin/views/pages/edit.py", line 386, in publish_action
backend_1             |     previous_revision=(self.previous_revision if self.is_reverting else None)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/core/models.py", line 3102, in publish        
backend_1             |     page.update_aliases(revision=self, user=user, _content_json=self.content_json)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/core/models.py", line 1573, in update_aliases 
backend_1             |     alias_updated.save(clean=False)
backend_1             |   File "/app/network-api/networkapi/wagtailpages/pagemodels/products.py", line 909, in save
backend_1             |     save = super().save(*args, **kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail_airtable/mixins.py", line 312, in save        
backend_1             |     saved_model = super().save(*args, **kwargs) # Save to database first so we get pk, in case it's used for uniqueness
backend_1             |   File "/usr/local/lib/python3.7/contextlib.py", line 74, in inner
backend_1             |     return func(*args, **kwds)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/wagtail/core/models.py", line 1052, in save
backend_1             |     result = super().save(**kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/modelcluster/models.py", line 199, in save
backend_1             |     getattr(self, relation).commit()
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/modelcluster/fields.py", line 210, in commit
backend_1             |     original_manager.add(item, bulk=False)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/fields/related_descriptors.py", line 
671, in add
backend_1             |     obj.save()
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/base.py", line 754, in save
backend_1             |     force_update=force_update, update_fields=update_fields)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/base.py", line 792, in save_base     
backend_1             |     force_update, using, update_fields,
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/base.py", line 895, in _save_table
backend_1             |     results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/base.py", line 935, in _do_insert    
backend_1             |     using=using, raw=raw,
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
backend_1             |     return getattr(self.get_queryset(), name)(*args, **kwargs)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/query.py", line 1254, in _insert     
backend_1             |     return query.get_compiler(using=using).execute_sql(returning_fields)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
backend_1             |     cursor.execute(sql, params)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/backends/utils.py", line 98, in execute     
backend_1             |     return super().execute(sql, params)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/backends/utils.py", line 66, in execute     
backend_1             |     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
backend_1             |     return executor(sql, params, many, context)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute    
backend_1             |     return self.cursor.execute(sql, params)
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
backend_1             |     raise dj_exc_value.with_traceback(traceback) from exc_value
backend_1             |   File "/app/dockerpythonvenv/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute    
backend_1             |     return self.cursor.execute(sql, params)
backend_1             | django.db.utils.IntegrityError: duplicate key value violates unique constraint "wagtailpages_productpage_translation_key_locale_i_5c988681_uniq"
backend_1             | DETAIL:  Key (translation_key, locale_id)=(1bc747eb-f088-430d-9158-b489ad6eb9ba, 7) already exists.
backend_1             | 
backend_1             | 2021-09-14 22:10:06,988 [ERROR] "POST /cms/pages/12512/edit/ HTTP/1.1" 500 32541
backend_1             | 2021-09-14 22:10:06,988 [ERROR] "POST /cms/pages/12512/edit/ HTTP/1.1" 500 32541

@TheoChevalier
Copy link
Contributor Author

TheoChevalier commented Sep 15, 2021

STR with local setup:

  1. run inv new-env
  2. docker-compose up
  3. Open http://localhost:8000/cms with credentials admin / admin
  4. Open the locale settings, add a locale (French for instance), synchronized from English
  5. Stop the server, then run inv manage sync_locale_trees
  6. Start the server again and go back to the locale settings, the new locale shouldn’t list 0 pages anymore.
  7. Navigate to (en) Homepage(en) Privacy Not Included and add a child page
  8. Pick General product Page (note: this will also fail when picking software products)
  9. Set title to "Test" and the Label field in the "Privacy policy links" section to "Test" (these are required fields)
  10. Hit publish

You should get the crash.

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

Successfully merging a pull request may close this issue.

3 participants