From b9550a1dab0dd8f889d471c01bc6f09405e8aa85 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Mon, 14 Aug 2023 23:00:26 +0100 Subject: [PATCH] Prevent error in data migration caused by long project name (#4525) * Test very long project names on CI * Fix migration --- .github/workflows/ci.yml | 2 +- .../contrib/sites/migrations/0003_set_site_domain_and_name.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbda77b5..3ff9f06a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: - name: Webpack args: "frontend_pipeline=Webpack use_heroku=y" - name: Email Username - args: "username_type=email ci_tool=Github" + args: "username_type=email ci_tool=Github project_name='Something superduper long - the great amazing project' project_slug=my_awesome_project" name: "Bare metal ${{ matrix.script.name }}" runs-on: ubuntu-latest diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py index 080c734b..e1822375 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/contrib/sites/migrations/0003_set_site_domain_and_name.py @@ -40,8 +40,8 @@ def update_site_forward(apps, schema_editor): _update_or_create_site_with_sequence( Site, schema_editor.connection, - "{{cookiecutter.domain_name}}", - "{{cookiecutter.project_name}}", + "{{ cookiecutter.domain_name }}", + "{{ cookiecutter.project_name[:50] }}", )