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

wagtail-localize breaks dump/load data #732

Open
FlorianLudwig opened this issue Nov 1, 2023 · 1 comment
Open

wagtail-localize breaks dump/load data #732

FlorianLudwig opened this issue Nov 1, 2023 · 1 comment

Comments

@FlorianLudwig
Copy link

Issue Summary

Having wagtail-localize breaks dump/load data

Steps to Reproduce

  1. wagtail start mysite .
  2. python manage.py createsuperuser
  3. Install wagtail-localize python module and add it to INSTALLED_APPS
  4. python manage.py runserver, login and publish subpage below root page
  5. export:
python manage.py dumpdata --natural-foreign --indent 2 \
    -e contenttypes -e auth.permission \
    -e wagtailcore.groupcollectionpermission \
    -e wagtailcore.grouppagepermission -e wagtailimages.rendition \
    -e sessions > data.json
  1. rm db.sqlite3
  2. python manage.py migrate
  3. python manage.py loaddata data.json

Error: django.db.utils.IntegrityError: Problem installing fixture 'data.json': Could not load wagtailcore.Page(pk=1): constraint failed

Technical details

  • Python version: 3.11
  • Django==4.2.7
  • wagtail==5.0.5
  • wagtail-localize==1.6
@zerolab
Copy link
Collaborator

zerolab commented Nov 1, 2023

Hey @FlorianLudwig thank you for the report.

I just tried this without localize and got the same problem. I had to tweak dumpdata to include -e wagtailsearch.indexentry and got the same error. So this is a core issue :/

tl;dr -

when you run manage.py migrate, the Root page (pk=1) gets created. the dump data also has:

{
  "model": "wagtailcore.page",
  "pk": 1,
  "fields": {
    "path": "0001",
    "depth": 1,
    "numchild": 1,
    "translation_key": "9d32c666-2272-41e1-a685-037061176c76",
    "locale": 1,
    "latest_revision": null,
    "live": true,
    "has_unpublished_changes": false,
    "first_published_at": null,
    "last_published_at": null,
    "live_revision": null,
    "go_live_at": null,
    "expire_at": null,
    "expired": false,
    "locked": false,
    "locked_at": null,
    "locked_by": null,
    "title": "Root",
    "draft_title": "Root",
    "slug": "root",
    "content_type": [
      "wagtailcore",
      "page"
    ],
    "url_path": "/",
    "owner": null,
    "seo_title": "",
    "show_in_menus": false,
    "search_description": "",
    "latest_revision_created_at": null,
    "alias_of": null
  }
},

hence the error

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

No branches or pull requests

2 participants