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 d532c2b5..964ed5b8 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 = (5, 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