Skip to content

Commit

Permalink
www/py-django-tagging: Add Django 3.2 compatibility
Browse files Browse the repository at this point in the history
* 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] Fantomas42/django-tagging#23
  • Loading branch information
Kevin Golding authored and knobix committed Jun 30, 2022
1 parent 3468647 commit 80b4f69
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion www/py-django-tagging/Makefile
Expand Up @@ -2,6 +2,7 @@

PORTNAME= django-tagging
PORTVERSION= 0.5.0
PORTREVISION= 1
CATEGORIES= www python
MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
Expand All @@ -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
Expand Down
22 changes: 22 additions & 0 deletions 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

0 comments on commit 80b4f69

Please sign in to comment.