From 8a92ea79331bb2e94dcd64aba5e42a5768a64510 Mon Sep 17 00:00:00 2001 From: Raphael Gaschignard Date: Tue, 24 Oct 2023 17:14:39 +0900 Subject: [PATCH] remove stale version checks --- taggit/__init__.py | 9 --------- taggit/managers.py | 20 ++++---------------- 2 files changed, 4 insertions(+), 25 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..228a979f 100644 --- a/taggit/managers.py +++ b/taggit/managers.py @@ -610,7 +610,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 +656,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 +736,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 +744,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