From 2e9a5927e8bd06ac594362aba993a2ab14eb3c8a Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 11:59:22 +0900 Subject: [PATCH 01/14] Change unique_together declaration to a unique constraint This is a database no-op --- .../migrations/0003_taggeditem_add_unique_index.py | 14 ++++++++++---- taggit/models.py | 7 ++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/taggit/migrations/0003_taggeditem_add_unique_index.py b/taggit/migrations/0003_taggeditem_add_unique_index.py index c46d1145..337719ff 100644 --- a/taggit/migrations/0003_taggeditem_add_unique_index.py +++ b/taggit/migrations/0003_taggeditem_add_unique_index.py @@ -1,4 +1,4 @@ -from django.db import migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -8,7 +8,13 @@ class Migration(migrations.Migration): ] operations = [ - migrations.AlterUniqueTogether( - name="taggeditem", unique_together={("content_type", "object_id", "tag")} - ) + # this migration was modified to declare a uniqueness constraint differently + # this change was written on 2023-09-20, if any issues occurred from this please report it upstream + migrations.AddConstraint( + model_name="taggeditem", + constraint=models.UniqueConstraint( + fields=("content_type", "object_id", "tag"), + name="taggit_taggeditem_content_type_id_object_id_tag_id_4bb97a8e_uniq", + ), + ), ] diff --git a/taggit/models.py b/taggit/models.py index 05bca49f..a4c12a7c 100644 --- a/taggit/models.py +++ b/taggit/models.py @@ -188,4 +188,9 @@ class Meta: verbose_name_plural = _("tagged items") app_label = "taggit" index_together = [["content_type", "object_id"]] - unique_together = [["content_type", "object_id", "tag"]] + constraints = [ + models.UniqueConstraint( + fields=("content_type", "object_id", "tag"), + name="taggit_taggeditem_content_type_id_object_id_tag_id_4bb97a8e_uniq", + ) + ] From bbda50fdc8f4ac3701db3e666a32a9f60bb2fe32 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 14:23:04 +0900 Subject: [PATCH 02/14] rename the index --- taggit/migrations/0002_auto_20150616_2121.py | 12 +++++++++--- ..._object_id_taggit_tagg_content_8fc721_idx.py | 17 +++++++++++++++++ taggit/models.py | 7 ++++++- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py diff --git a/taggit/migrations/0002_auto_20150616_2121.py b/taggit/migrations/0002_auto_20150616_2121.py index af30bc08..2317f678 100644 --- a/taggit/migrations/0002_auto_20150616_2121.py +++ b/taggit/migrations/0002_auto_20150616_2121.py @@ -1,11 +1,17 @@ -from django.db import migrations +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("taggit", "0001_initial")] operations = [ - migrations.AlterIndexTogether( - name="taggeditem", index_together={("content_type", "object_id")} + migrations.AddIndex( + "taggeditem", + models.Index( + fields=("content_type", "object_id"), + # this is not the name of the index in previous version, + # but this is ncessary to deal with index_together issues. + name="taggit_tagg_content_8fc721_idx", + ), ) ] diff --git a/taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py b/taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py new file mode 100644 index 00000000..3efcb1de --- /dev/null +++ b/taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.5 on 2023-09-19 23:16 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("taggit", "0005_auto_20220424_2025"), + ] + + operations = [ + migrations.RenameIndex( + model_name="taggeditem", + new_name="taggit_tagg_content_8fc721_idx", + old_fields=("content_type", "object_id"), + ), + ] diff --git a/taggit/models.py b/taggit/models.py index a4c12a7c..8d7f60bd 100644 --- a/taggit/models.py +++ b/taggit/models.py @@ -187,7 +187,12 @@ class Meta: verbose_name = _("tagged item") verbose_name_plural = _("tagged items") app_label = "taggit" - index_together = [["content_type", "object_id"]] + indexes = [ + models.Index( + fields=["content_type", "object_id"], + ) + ] + constraints = [ models.UniqueConstraint( fields=("content_type", "object_id", "tag"), From 40543ac7c2a5a616927beaebc10c15594a09fc60 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 14:36:10 +0900 Subject: [PATCH 03/14] remove usages of deprecated test helper --- tests/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tests.py b/tests/tests.py index 4b837fc5..3cb85383 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -591,7 +591,7 @@ def test_lookup_by_tag(self): pks = self.pet_model.objects.filter(tags__name__in=["fuzzy"]) model_name = self.pet_model.__name__ - self.assertQuerysetEqual( + self.assertQuerySetEqual( pks, [f"<{model_name}: kitty>", f"<{model_name}: cat>"], ordered=False, @@ -609,7 +609,7 @@ def test_exclude(self): pks = self.food_model.objects.exclude(tags__name__in=["red"]) model_name = self.food_model.__name__ - self.assertQuerysetEqual( + self.assertQuerySetEqual( pks, [f"<{model_name}: pear>", f"<{model_name}: guava>"], ordered=False, From 21e73f7ab1b52e6df615d11871602b187a335dcc Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 14:36:19 +0900 Subject: [PATCH 04/14] specify timezone --- tests/settings.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/settings.py b/tests/settings.py index 3e96efdf..4e7a4b21 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -43,3 +43,5 @@ STATIC_URL = "/static/" DEFAULT_AUTO_FIELD = "django.db.models.AutoField" + +USE_TZ = True From 7ff7c8693fc10b63bf0d0704552545b66298d473 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 14:36:28 +0900 Subject: [PATCH 05/14] use div rendering for test forms This shouldn't affect anything outside of tests --- tests/tests.py | 88 ++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 63 deletions(-) diff --git a/tests/tests.py b/tests/tests.py index 3cb85383..83930654 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -958,42 +958,25 @@ class TaggableFormTestCase(BaseTaggingTestCase): food_model = Food def _get_form_str(self, form_str): - if DJANGO_VERSION >= (5, 0): - # Django defaults to div-based form rendering in 5.0 - # https://github.com/django/django/commit/98756c685ee173bbd43f21ed0553f808be835ce5 - # https://github.com/django/django/commit/232b60a21b951bd16b8c95b34fcbcbf3ecd89fca - form_str %= { - "help_start": '
', - "help_stop": "
", - "required": "required", - } - else: - form_str %= { - "help_start": '', - "help_stop": "", - "required": "required", - } + form_str %= { + "help_start": '
', + "help_stop": "
", + "required": "required", + } return form_str def assertFormRenders(self, form, html): - self.assertHTMLEqual(str(form), self._get_form_str(html)) + self.assertHTMLEqual(form.as_div(), self._get_form_str(html)) def test_form(self): self.assertEqual(list(self.form_class.base_fields), ["name", "tags"]) f = self.form_class({"name": "apple", "tags": "green, red, yummy"}) - if DJANGO_VERSION >= (5, 0): - self.assertFormRenders( - f, - """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) - else: - self.assertFormRenders( - f, - """ -
%(help_start)sA comma-separated list of tags.%(help_stop)s""", - ) + self.assertFormRenders( + f, + """
+
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", + ) f.save() apple = self.food_model.objects.get(name="apple") self.assert_tags_equal(apple.tags.all(), ["green", "red", "yummy"]) @@ -1010,48 +993,27 @@ def test_form(self): self.assertFalse(f.is_valid()) f = self.form_class(instance=apple) - if DJANGO_VERSION >= (5, 0): - self.assertFormRenders( - f, - """
+ self.assertFormRenders( + f, + """
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) - else: - self.assertFormRenders( - f, - """ -
%(help_start)sA comma-separated list of tags.%(help_stop)s""", - ) + ) apple.tags.add("has,comma") f = self.form_class(instance=apple) - if DJANGO_VERSION >= (5, 0): - self.assertFormRenders( - f, - """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) - else: - self.assertFormRenders( - f, - """ -
%(help_start)sA comma-separated list of tags.%(help_stop)s""", - ) + self.assertFormRenders( + f, + """
+
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", + ) apple.tags.add("has space") f = self.form_class(instance=apple) - if DJANGO_VERSION >= (5, 0): - self.assertFormRenders( - f, - """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) - else: - self.assertFormRenders( - f, - """ -
%(help_start)sA comma-separated list of tags.%(help_stop)s""", - ) + self.assertFormRenders( + f, + """
+
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", + ) def test_formfield(self): tm = TaggableManager( From 822f1c89d42d47bed43c29eab0d1b43ef6c82781 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 15:21:10 +0900 Subject: [PATCH 06/14] queryset equal rename --- tests/tests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/tests.py b/tests/tests.py index 83930654..957d53ca 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -67,6 +67,9 @@ UUIDTaggedItem, ) +if DJANGO_VERSION < (4, 2): + TestCase.assertQuerySetEqual = TestCase.assertQuerysetEqual + class BaseTaggingTestCase(TestCase): def assert_tags_equal(self, qs, tags, sort=True, attr="name"): From 41ad0a3d77d10a03bfb14a98243014d096ca87bd Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 15:21:26 +0900 Subject: [PATCH 07/14] Revert "use div rendering for test forms" This reverts commit 7ff7c8693fc10b63bf0d0704552545b66298d473. --- tests/tests.py | 88 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/tests/tests.py b/tests/tests.py index 957d53ca..e04a6e9e 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -961,25 +961,42 @@ class TaggableFormTestCase(BaseTaggingTestCase): food_model = Food def _get_form_str(self, form_str): - form_str %= { - "help_start": '
', - "help_stop": "
", - "required": "required", - } + if DJANGO_VERSION >= (5, 0): + # Django defaults to div-based form rendering in 5.0 + # https://github.com/django/django/commit/98756c685ee173bbd43f21ed0553f808be835ce5 + # https://github.com/django/django/commit/232b60a21b951bd16b8c95b34fcbcbf3ecd89fca + form_str %= { + "help_start": '
', + "help_stop": "
", + "required": "required", + } + else: + form_str %= { + "help_start": '', + "help_stop": "", + "required": "required", + } return form_str def assertFormRenders(self, form, html): - self.assertHTMLEqual(form.as_div(), self._get_form_str(html)) + self.assertHTMLEqual(str(form), self._get_form_str(html)) def test_form(self): self.assertEqual(list(self.form_class.base_fields), ["name", "tags"]) f = self.form_class({"name": "apple", "tags": "green, red, yummy"}) - self.assertFormRenders( - f, - """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) + if DJANGO_VERSION >= (5, 0): + self.assertFormRenders( + f, + """
+
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", + ) + else: + self.assertFormRenders( + f, + """ +
%(help_start)sA comma-separated list of tags.%(help_stop)s""", + ) f.save() apple = self.food_model.objects.get(name="apple") self.assert_tags_equal(apple.tags.all(), ["green", "red", "yummy"]) @@ -996,27 +1013,48 @@ def test_form(self): self.assertFalse(f.is_valid()) f = self.form_class(instance=apple) - self.assertFormRenders( - f, - """
+ if DJANGO_VERSION >= (5, 0): + self.assertFormRenders( + f, + """
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) + ) + else: + self.assertFormRenders( + f, + """ +
%(help_start)sA comma-separated list of tags.%(help_stop)s""", + ) apple.tags.add("has,comma") f = self.form_class(instance=apple) - self.assertFormRenders( - f, - """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) + if DJANGO_VERSION >= (5, 0): + self.assertFormRenders( + f, + """
+
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", + ) + else: + self.assertFormRenders( + f, + """ +
%(help_start)sA comma-separated list of tags.%(help_stop)s""", + ) apple.tags.add("has space") f = self.form_class(instance=apple) - self.assertFormRenders( - f, - """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", - ) + if DJANGO_VERSION >= (5, 0): + self.assertFormRenders( + f, + """
+
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", + ) + else: + self.assertFormRenders( + f, + """ +
%(help_start)sA comma-separated list of tags.%(help_stop)s""", + ) def test_formfield(self): tm = TaggableManager( From 2f65f97fe58b538e52ef4991a36ef79f27e9b48e Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 15:59:03 +0900 Subject: [PATCH 08/14] Deal with deprecation warnings on djmain --- taggit/managers.py | 15 +++++++++++++-- tests/tests.py | 15 +++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/taggit/managers.py b/taggit/managers.py index 85542c90..90a24a3d 100644 --- a/taggit/managers.py +++ b/taggit/managers.py @@ -84,8 +84,19 @@ def get_queryset(self, extra_filters=None): ) def get_prefetch_queryset(self, instances, queryset=None): - if queryset is not None: - raise ValueError("Custom queryset can't be used for this lookup.") + if queryset is None: + return self.get_prefetch_querysets(instances) + else: + return self.get_prefetch_querysets(instances, [queryset]) + + def get_prefetch_querysets(self, instances, querysets=None): + if querysets is not None: + # this queryset is meant to be used for filtering down the prefetch + # this work has not been done yet. + # + # Some hint from Django: asserting that len(querysets) == 1 if it's not None + # and then using that to filter down the qs + raise ValueError("Custom querysets can't be used for this lookup.") instance = instances[0] db = self._db or router.db_for_read(type(instance), instance=instance) diff --git a/tests/tests.py b/tests/tests.py index e04a6e9e..cb0f1687 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -966,20 +966,23 @@ def _get_form_str(self, form_str): # https://github.com/django/django/commit/98756c685ee173bbd43f21ed0553f808be835ce5 # https://github.com/django/django/commit/232b60a21b951bd16b8c95b34fcbcbf3ecd89fca form_str %= { - "help_start": '
', + "help_start": '
', "help_stop": "
", "required": "required", + "aria": 'aria-describedby="id_tags_helptext"', } else: form_str %= { "help_start": '', "help_stop": "", "required": "required", + "aria": "", } return form_str def assertFormRenders(self, form, html): - self.assertHTMLEqual(str(form), self._get_form_str(html)) + rendered_form = form.as_table() if DJANGO_VERSION < (5, 0) else form.as_div() + self.assertHTMLEqual(rendered_form, self._get_form_str(html)) def test_form(self): self.assertEqual(list(self.form_class.base_fields), ["name", "tags"]) @@ -989,7 +992,7 @@ def test_form(self): self.assertFormRenders( f, """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", +
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", ) else: self.assertFormRenders( @@ -1017,7 +1020,7 @@ def test_form(self): self.assertFormRenders( f, """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", +
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", ) else: self.assertFormRenders( @@ -1032,7 +1035,7 @@ def test_form(self): self.assertFormRenders( f, """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", +
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", ) else: self.assertFormRenders( @@ -1047,7 +1050,7 @@ def test_form(self): self.assertFormRenders( f, """
-
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", +
%(help_start)sA comma-separated list of tags.%(help_stop)s
""", ) else: self.assertFormRenders( From 467792f88745a8c0cd7fc85f3bba8875acffac73 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 15:59:30 +0900 Subject: [PATCH 09/14] make sure flake excludes common venv and tox locations --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index 74607fd9..086949a9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,7 @@ exclude = tests* [flake8] # E501: line too long ignore = E501 +exclude = .venv,.git,.tox [isort] profile = black From b347c016aa7742a5473567d613351862b5b85d47 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 16:00:43 +0900 Subject: [PATCH 10/14] remove python 3.7 support --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index f85dc4ed..8bf1a4a8 100644 --- a/tox.ini +++ b/tox.ini @@ -4,14 +4,13 @@ envlist = black flake8 isort - py{37,38,39,310}-dj32 + py{38,39,310}-dj32 py{38,39,310,311}-dj{41,42} py{310,311}-djmain docs [gh-actions] python = - 3.7: py37 3.8: py38, black, flake8, isort 3.9: py39 3.10: py310 @@ -39,6 +38,7 @@ basepython = python3 skip_install = true deps = black commands = black --target-version=py37 --check --diff . +commands = black --target-version=py38 --check --diff . [testenv:flake8] basepython = python3 From 6add0a1d22945986ca336146a71acd27d2734939 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 16:01:08 +0900 Subject: [PATCH 11/14] enable warnings in tests --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 8bf1a4a8..4b195849 100644 --- a/tox.ini +++ b/tox.ini @@ -24,6 +24,8 @@ deps = djmain: https://github.com/django/django/archive/main.tar.gz coverage djangorestframework +setenv = + PYTHONWARNINGS=all commands = coverage run -m django test --settings=tests.settings {posargs} coverage report @@ -37,7 +39,6 @@ ignore_errors = basepython = python3 skip_install = true deps = black -commands = black --target-version=py37 --check --diff . commands = black --target-version=py38 --check --diff . [testenv:flake8] From da33f5a6f9e3773f53a645954ad4ab1dca72b018 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 17:00:36 +0900 Subject: [PATCH 12/14] Remove Django 3.2 support --- CHANGELOG.rst | 9 +++++++++ ...tent_type_object_id_taggit_tagg_content_8fc721_idx.py | 1 - tox.ini | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1e413b10..bc8367d5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,15 @@ Changelog (Unreleased) ~~~~~~~~~~~~ +* **Backwards icompatible:** Rename the (``content_type``, ``object_id``) index on ``TaggedItem``. + It is very unlikely for this to affect your code itself, and a migration will rename the index. This should not cause any downtime according to my research (Postgres does not lock the table for index renames, and Oracle holds a tiny lock to do it, and the change is only to the metadata, so is not dependent on table size). + +* **Backwards incompatible:** Remove the ``.indexed_together`` and ``.unique_together`` attributes on ``TaggedItem`` + + We are instead using ``constraints`` and ``indexes`` to set up these properties. +* Remove support for Django 3.2. +* Remove usage of deprecated APIs for Django 4.2 +* Remove support for Python 3.7 (no code changes involved) * Fix ``tag_kwargs`` and ``TAGGIT_CASE_INSENSITIVE=True`` discrepency. 4.0.0 (2023-05-04) diff --git a/taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py b/taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py index 3efcb1de..c23966c0 100644 --- a/taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py +++ b/taggit/migrations/0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx.py @@ -1,5 +1,4 @@ # Generated by Django 4.2.5 on 2023-09-19 23:16 - from django.db import migrations diff --git a/tox.ini b/tox.ini index 4b195849..f39ffbfb 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,6 @@ envlist = black flake8 isort - py{38,39,310}-dj32 py{38,39,310,311}-dj{41,42} py{310,311}-djmain docs @@ -18,7 +17,6 @@ python = [testenv] deps = - dj32: Django>=3.2,<3.3 dj41: Django>=4.1,<4.2 dj42: Django>=4.2,<5.0 djmain: https://github.com/django/django/archive/main.tar.gz From 6e75ec4318ab9d3c8c1375dec3ffe8a2beb5093d Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 22:55:48 +0900 Subject: [PATCH 13/14] add some comments to the migration itself --- taggit/migrations/0002_auto_20150616_2121.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/taggit/migrations/0002_auto_20150616_2121.py b/taggit/migrations/0002_auto_20150616_2121.py index 2317f678..9d5e76d3 100644 --- a/taggit/migrations/0002_auto_20150616_2121.py +++ b/taggit/migrations/0002_auto_20150616_2121.py @@ -5,12 +5,18 @@ class Migration(migrations.Migration): dependencies = [("taggit", "0001_initial")] operations = [ + # this migration was modified from previously being + # a ModifyIndexTogether operation. + # + # If you are a long-enough user of this library, the name + # of the index does not match what is written here. Please + # query the DB itself to find out what the name originally was. migrations.AddIndex( "taggeditem", models.Index( fields=("content_type", "object_id"), # this is not the name of the index in previous version, - # but this is ncessary to deal with index_together issues. + # but this is necessary to deal with index_together issues. name="taggit_tagg_content_8fc721_idx", ), ) From 60064a7908cb596760ff19c301cb996cb32c6c6b Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Wed, 20 Sep 2023 23:02:53 +0900 Subject: [PATCH 14/14] Remove Python 3.7 from the github test matrix as well --- .github/workflows/test.yml | 72 ++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ca51c53..55daaedb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,42 +20,40 @@ jobs: matrix: python-version: - - '3.7' - - '3.8' - - '3.9' - - '3.10' - - '3.11' + - "3.8" + - "3.9" + - "3.10" + - "3.11" steps: - - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Get pip cache dir - id: pip-cache - run: echo "::set-output name=dir::$(pip cache dir)" - - - name: Cache - uses: actions/cache@v2 - with: - path: ${{ steps.pip-cache.outputs.dir }} - key: - ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }} - restore-keys: | - ${{ matrix.python-version }}-v1- - - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - python -m pip install --upgrade tox tox-gh-actions - - - name: Tox tests - run: tox -v - - - name: Upload coverage - uses: codecov/codecov-action@v1 - with: - name: Python ${{ matrix.python-version }} + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }} + restore-keys: | + ${{ matrix.python-version }}-v1- + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade tox tox-gh-actions + + - name: Tox tests + run: tox -v + + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + name: Python ${{ matrix.python-version }}