Browse Source

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
Matt Westcott 2 years ago
parent
commit
5b4242df3c

+ 0 - 1
.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:

+ 1 - 1
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",

+ 7 - 1
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={

+ 7 - 1
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)),
+            ),
         ),
     ]