From ba76821bbcb8c57447a142f4467c714aa4f1f169 Mon Sep 17 00:00:00 2001 From: Jacob Rief Date: Tue, 5 May 2020 00:10:20 +0200 Subject: [PATCH] drop support form django-CMS < 3.5 --- shop/models/product.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/shop/models/product.py b/shop/models/product.py index 5fcfe7ff5..65a4667da 100644 --- a/shop/models/product.py +++ b/shop/models/product.py @@ -1,10 +1,7 @@ -from distutils.version import LooseVersion from functools import reduce import operator from urllib.parse import urljoin -from cms import __version__ as CMS_VERSION - from django.apps import apps from django.conf import settings from django.core import cache, checks @@ -272,7 +269,7 @@ def get_product_variant(self, **kwargs): def get_product_variants(self): """ Hook for returning a queryset of variants for the given product. - If the product has no variants, then the queryset contains just that product. + If the product has no variants, then the queryset contains just itself. """ return self._meta.model.objects.filter(pk=self.pk) @@ -352,7 +349,7 @@ def check(cls, **kwargs): def update_search_index(self): """ - Update the document model inside the Elasticsearch index after changing relevant parts + Update the Document inside the Elasticsearch index after changing relevant parts of the product. """ documents = elasticsearch_registry.get_documents([ProductModel]) @@ -393,10 +390,7 @@ def get_absolute_url(self): """ # sorting by highest level, so that the canonical URL # associates with the most generic category - if LooseVersion(CMS_VERSION) < LooseVersion('3.5'): - cms_page = self.cms_pages.order_by('depth').last() - else: - cms_page = self.cms_pages.order_by('node__path').last() + cms_page = self.cms_pages.order_by('node__path').last() if cms_page is None: return urljoin('/category-not-assigned/', self.slug) return urljoin(cms_page.get_absolute_url(), self.slug)