From 5b4242df3ca5636206d89e134f85725b41fe89cc Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Mon, 2 May 2022 14:47:48 +0100 Subject: [PATCH] Fix test migrations for django-taggit 3.0.0 (#8451) * Fix test migrations for django-taggit 3.0.0 (forthcoming) The next release of django-taggit [will change slugs to allow_unicode=True](https://github.com/jazzband/django-taggit/pull/797), which breaks our check for missing migrations. This change is not released yet, but the fix is needed now so that we can run against django-taggit git master for our tests against Django main. It's also dependent on the version bump happening at the django-taggit end: https://github.com/jazzband/django-taggit/pull/800 * Allow django-taggit 3.x as a dependency and drop special case when testing against Django main --- .github/workflows/test.yml | 1 - setup.py | 2 +- wagtail/test/testapp/migrations/0047_restaurant_tags.py | 8 +++++++- wagtail/test/testapp/migrations/0051_tag_verbose_name.py | 8 +++++++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f07800a33..16915c67cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -82,7 +82,6 @@ jobs: - python: '3.10' django: 'git+https://github.com/django/django.git@main#egg=Django' experimental: true - install_extras: 'pip uninstall -y django-taggit ; pip install git+https://github.com/jazzband/django-taggit.git@master#egg=django-taggit' services: postgres: diff --git a/setup.py b/setup.py index f081817734..dbac967087 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ install_requires = [ "Django>=3.2,<4.1", "django-modelcluster>=6.0,<7.0", "django-permissionedforms>=0.1,<1.0", - "django-taggit>=2.0,<3.0", + "django-taggit>=2.0,<4.0", "django-treebeard>=4.5.1,<5.0", "djangorestframework>=3.11.1,<4.0", "django-filter>=2.2,<22", diff --git a/wagtail/test/testapp/migrations/0047_restaurant_tags.py b/wagtail/test/testapp/migrations/0047_restaurant_tags.py index 52c7e7e98e..dd313e0c7a 100644 --- a/wagtail/test/testapp/migrations/0047_restaurant_tags.py +++ b/wagtail/test/testapp/migrations/0047_restaurant_tags.py @@ -4,6 +4,7 @@ from django.db import migrations, models import django.db.models.deletion import modelcluster.contrib.taggit import modelcluster.fields +from taggit import VERSION as TAGGIT_VERSION class Migration(migrations.Migration): @@ -52,7 +53,12 @@ class Migration(migrations.Migration): ), ( "slug", - models.SlugField(max_length=100, unique=True, verbose_name="slug"), + models.SlugField( + max_length=100, + unique=True, + verbose_name="slug", + allow_unicode=(TAGGIT_VERSION >= (3, 0, 0)), + ), ), ], options={ diff --git a/wagtail/test/testapp/migrations/0051_tag_verbose_name.py b/wagtail/test/testapp/migrations/0051_tag_verbose_name.py index 9b400fa81e..11a8263ff9 100644 --- a/wagtail/test/testapp/migrations/0051_tag_verbose_name.py +++ b/wagtail/test/testapp/migrations/0051_tag_verbose_name.py @@ -1,6 +1,7 @@ # Generated by Django 3.0.6 on 2020-05-26 09:29 from django.db import migrations, models +from taggit import VERSION as TAGGIT_VERSION class Migration(migrations.Migration): @@ -18,6 +19,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="restauranttag", name="slug", - field=models.SlugField(max_length=100, unique=True, verbose_name="slug"), + field=models.SlugField( + max_length=100, + unique=True, + verbose_name="slug", + allow_unicode=(TAGGIT_VERSION >= (3, 0, 0)), + ), ), ]