aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Golding <ports@caomhin.org>2022-06-30 07:04:53 +0000
committerKai Knoblich <kai@FreeBSD.org>2022-06-30 07:19:28 +0000
commit80b4f695a700f521a0c0415009a1536cd5987123 (patch)
treeb3c01059cc007585249249942ebeb9e3761eb171
parent346864723634e4d90e8c4655bc3ad8bcd1c6cd94 (diff)
downloadports-80b4f695a700f521a0c0415009a1536cd5987123.tar.gz
ports-80b4f695a700f521a0c0415009a1536cd5987123.zip
www/py-django-tagging: Add Django 3.2 compatibility
* Add a patch to incorporate an upstream pull-request [1] to address the Django 2.2 deprecation [2] and set dependency to Django 3.2. PR: 263216, 261313 [2] Obtained from: [1] https://github.com/Fantomas42/django-tagging/pull/23/
-rw-r--r--www/py-django-tagging/Makefile3
-rw-r--r--www/py-django-tagging/files/patch-tagging_models.py22
2 files changed, 24 insertions, 1 deletions
diff --git a/www/py-django-tagging/Makefile b/www/py-django-tagging/Makefile
index db38462200b1..fe2b06a7c88a 100644
--- a/www/py-django-tagging/Makefile
+++ b/www/py-django-tagging/Makefile
@@ -2,6 +2,7 @@
PORTNAME= django-tagging
PORTVERSION= 0.5.0
+PORTREVISION= 1
CATEGORIES= www python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -13,7 +14,7 @@ LICENSE= BSD3CLAUSE MIT
LICENSE_COMB= multi
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
-RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}django22>=1.11:www/py-django22@${PY_FLAVOR}
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}django32>=0:www/py-django32@${PY_FLAVOR}
USES= python:3.5+
USE_PYTHON= distutils autoplist
diff --git a/www/py-django-tagging/files/patch-tagging_models.py b/www/py-django-tagging/files/patch-tagging_models.py
new file mode 100644
index 000000000000..5c4c00ac7116
--- /dev/null
+++ b/www/py-django-tagging/files/patch-tagging_models.py
@@ -0,0 +1,22 @@
+--- tagging/models.py.orig 2022-04-11 10:40:39 UTC
++++ tagging/models.py
+@@ -5,6 +5,7 @@ from django.contrib.contenttypes.fields import Generic
+ from django.contrib.contenttypes.models import ContentType
+ from django.db import connection
+ from django.db import models
++from django.db.models.query_utils import Q
+ from django.utils.encoding import smart_text
+ from django.utils.translation import gettext_lazy as _
+
+@@ -155,8 +156,9 @@ class TagManager(models.Manager):
+ filters = {}
+
+ queryset = model._default_manager.filter()
+- for f in filters.items():
+- queryset.query.add_filter(f)
++ for k, v in filters.items():
++ # Add support for both Django 4 and inferior versions
++ queryset.query.add_q(Q((k, v)))
+ usage = self.usage_for_queryset(queryset, counts, min_count)
+
+ return usage