From e10c762b32a2061a52cc80af9a6d5ecda6b785ed Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Tue, 24 Oct 2023 17:14:39 +0900 Subject: [PATCH 1/2] remove stale version checks --- taggit/__init__.py | 9 --------- taggit/managers.py | 21 ++++----------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/taggit/__init__.py b/taggit/__init__.py index d532c2b5..aef70a7e 100644 --- a/taggit/__init__.py +++ b/taggit/__init__.py @@ -1,11 +1,2 @@ -try: - import django -except ImportError: - # setup.py and docs do not have Django installed. - django = None - VERSION = (4, 0, 0) __version__ = ".".join(str(i) for i in VERSION) - -if django and django.VERSION < (3, 2): - default_app_config = "taggit.apps.TaggitAppConfig" diff --git a/taggit/managers.py b/taggit/managers.py index 90a24a3d..4d7f0140 100644 --- a/taggit/managers.py +++ b/taggit/managers.py @@ -1,7 +1,6 @@ import uuid from operator import attrgetter -import django from django.conf import settings from django.contrib.contenttypes.fields import GenericRelation from django.contrib.contenttypes.models import ContentType @@ -610,7 +609,7 @@ def _get_mm_case_path_info(self, direct=False, filtered_relation=None): pathinfos = [] linkfield1 = self.through._meta.get_field("content_object") linkfield2 = self.through._meta.get_field(self.m2m_reverse_field_name()) - if django.VERSION >= (4, 1) and not filtered_relation: + if not filtered_relation: # Django >= 4.1 provides cached path_infos and reverse_path_infos properties # to use in preference to get_path_info / get_reverse_path_info when not # passing a filtered_relation @@ -656,14 +655,14 @@ def _get_gfk_case_path_info(self, direct=False, filtered_relation=None): filtered_relation, ) ] - if django.VERSION >= (4, 1) and not filtered_relation: + if not filtered_relation: join2infos = linkfield.path_infos else: join2infos = linkfield.get_path_info( filtered_relation=filtered_relation ) else: - if django.VERSION >= (4, 1) and not filtered_relation: + if not filtered_relation: join1infos = linkfield.reverse_path_infos else: join1infos = linkfield.get_reverse_path_info( @@ -736,7 +735,7 @@ def get_joining_fields(self, reverse_join=False): ), ) - def _get_extra_restriction(self, alias, related_alias): + def get_extra_restriction(self, alias, related_alias): extra_col = self.through._meta.get_field("content_type").column content_type_ids = [ ContentType.objects.get_for_model(subclass).pk @@ -744,18 +743,6 @@ def _get_extra_restriction(self, alias, related_alias): ] return ExtraJoinRestriction(related_alias, extra_col, content_type_ids) - def _get_extra_restriction_legacy(self, where_class, alias, related_alias): - # this is a shim to maintain compatibility with django < 4.0 - return self._get_extra_restriction(alias, related_alias) - - # this is required to handle a change in Django 4.0 - # https://docs.djangoproject.com/en/4.0/releases/4.0/#miscellaneous - # the signature of the (private) function was changed - if django.VERSION < (4, 0): - get_extra_restriction = _get_extra_restriction_legacy - else: - get_extra_restriction = _get_extra_restriction - def get_reverse_joining_columns(self): # RemovedInDjango60Warning # https://github.com/django/django/commit/8b1ff0da4b162e87edebd94e61f2cd153e9e159d From fa7e698c2a5ae4c18102e6dc1333cebf45506af7 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Tue, 24 Oct 2023 17:15:26 +0900 Subject: [PATCH 2/2] Prepare Taggit 5.0.0 --- CHANGELOG.rst | 3 +++ taggit/__init__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index bc8367d5..409462a0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,9 @@ Changelog (Unreleased) ~~~~~~~~~~~~ + +5.0.0 (2023-10-24) +~~~~~~~~~~~~~~~~~~ * **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). diff --git a/taggit/__init__.py b/taggit/__init__.py index aef70a7e..964ed5b8 100644 --- a/taggit/__init__.py +++ b/taggit/__init__.py @@ -1,2 +1,2 @@ -VERSION = (4, 0, 0) +VERSION = (5, 0, 0) __version__ = ".".join(str(i) for i in VERSION)