From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 4CiaJeNymGSSdQAASxT56A (envelope-from ) for ; Sun, 25 Jun 2023 19:01:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id EBqwJeNymGTKwAAAauVa8A (envelope-from ) for ; Sun, 25 Jun 2023 19:01:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3E7066F48 for ; Sun, 25 Jun 2023 19:01:23 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDT6q-0004tm-RY; Sun, 25 Jun 2023 13:01:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDT6o-0004oo-H3 for guix-patches@gnu.org; Sun, 25 Jun 2023 13:01:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDT6o-0001xI-7c for guix-patches@gnu.org; Sun, 25 Jun 2023 13:01:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDT6l-0006BE-Gu; Sun, 25 Jun 2023 13:01:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55474] [PATCH v5 23/55] gnu: python-django-tagging: Add patch for django@4 support. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: lars@6xq.net, jgart@dismail.de, guix-patches@gnu.org Resent-Date: Sun, 25 Jun 2023 17:01:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55474 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55474@debbugs.gnu.org Cc: ngraves@ngraves.fr, Lars-Dominik Braun , jgart X-Debbugs-Original-Xcc: Lars-Dominik Braun , jgart Received: via spool by 55474-submit@debbugs.gnu.org id=B55474.168771242923538 (code B ref 55474); Sun, 25 Jun 2023 17:01:03 +0000 Received: (at 55474) by debbugs.gnu.org; 25 Jun 2023 17:00:29 +0000 Received: from localhost ([127.0.0.1]:43420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDT6D-00067Y-1s for submit@debbugs.gnu.org; Sun, 25 Jun 2023 13:00:29 -0400 Received: from 14.mo561.mail-out.ovh.net ([188.165.43.98]:57871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDT66-00067F-Of for 55474@debbugs.gnu.org; Sun, 25 Jun 2023 13:00:24 -0400 Received: from director8.ghost.mail-out.ovh.net (unknown [10.109.138.245]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id B2867247DA for <55474@debbugs.gnu.org>; Sun, 25 Jun 2023 17:00:21 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-nxl7z (unknown [10.110.115.102]) by director8.ghost.mail-out.ovh.net (Postfix) with ESMTPS id A586C1FD48; Sun, 25 Jun 2023 17:00:15 +0000 (UTC) Received: from ngraves.fr ([37.59.142.107]) by ghost-submission-6684bf9d7b-nxl7z with ESMTPSA id 3fmWIJ9ymGRxAQAAVaLPcA (envelope-from ); Sun, 25 Jun 2023 17:00:15 +0000 X-OVh-ClientIp: 80.215.66.29 Date: Sun, 25 Jun 2023 18:57:24 +0200 Message-Id: <8d4edd2715e9bba1ec6bc4620e0c7f99bb81dcb5.1687712245.git.ngraves@ngraves.fr> X-Mailer: git-send-email 2.40.1 In-Reply-To: <79ade078335720d3a5595676a65788789415bce0.1687712245.git.ngraves@ngraves.fr> References: <79ade078335720d3a5595676a65788789415bce0.1687712245.git.ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 8261009094880649954 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrgeehtddguddthecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpedvheelieffheetvdelhfffffejfefgudfhteekveehieetudeiudfgkeeutdehjeenucffohhmrghinhepghhithhhuhgsrdgtohhmnecukfhppeduvdejrddtrddtrddupdektddrvdduhedrieeirddvledpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepheehgeejgeesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheeiuddpmhhouggvpehsmhhtphhouhht X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1687712483; a=rsa-sha256; cv=none; b=pTH0+c5m3piSdbL7p8ztOx/V5O+/IMosHGUT6f/rePh+eeDvSO4otFfALHr0DSzyTG/TAz l/Ljx7U8Cn8M8GfIstdDNU2iOqTWZaGJGYmB+D5+Gw+4PbK2gCg64xWrJCsC5ApYH91IgA Mdm3OWZaRGllHyGBi/h8/QQeIavy8xpvigVtajdBimS+E5uSWpqKAFBoNXDRcLrCLaK3qU d93Q+yl+ho2oz/0xqnJCzDdfUCwhI3ReW6bkfOdXvU3cbmMH+fvQ1CK9YXzroztjbTEykR Q58E6NilhzgmMqHKL3GCDPQrDw68FxKoaKtT5UjxDbG8TjND3dp1CMR7AV2Hig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1687712483; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=dOAcUrnSa5hEOcV0ZzHeDCWXbzL5kVzoCWiwgmA42i0=; b=MzlPfKGw0o7q3HlRBof+qNVE0AKEBgrLAg8ojLFWM5DoiF5JrCaDH7Et6gAB16N5sMYcMl PF9fVlWMEtOq1DOjApZy69TsZHMN6dWYrSYzLwjVKddVzVocu7iC/I/VjXnedl8/YhFm36 XV5NmFgZjyy1uuYy0j9CAUjubPf80FBpAha4rnj/qTiu7xVgyGjZNPQZNZd1iR+pE4kqCm FeWBFOtsoxpiNLLQNjVxR9ZCm0ooFuWLeBuFcIlh40GVi/GMhjgEixRO7omBbE7RaF1oZA +Fm+T7D4fF72WDRzOJHEgsHK/+wws138s8IOfv3TeoNEKCJCRPZ9pssswuk4sw== Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -4.25 X-Spam-Score: -4.25 X-Migadu-Queue-Id: 3E7066F48 X-TUID: HGAw3Dym1te3 * gnu/packages/django.scm (python-django-tagging): Add patch for django@4 support. [source](patches): Add patch for django@4 support. [native-inputs]: Add tzdata-for-tests. * gnu/packages/patches/python-django-tagging-django-4-support.patch --- gnu/packages/django.scm | 7 +- ...thon-django-tagging-django-4-support.patch | 101 ++++++++++++++++++ 2 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/python-django-tagging-django-4-support.patch diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm index c689526a6d..b5830234b4 100644 --- a/gnu/packages/django.scm +++ b/gnu/packages/django.scm @@ -1071,8 +1071,9 @@ (define-public python-django-tagging (method url-fetch) (uri (pypi-uri "django-tagging" version)) (sha256 - (base32 - "13afxx30chssclxzd9gqnvwm9qyrdpnlbs6iswdfa18phfj8zmi8")))) + (base32 "13afxx30chssclxzd9gqnvwm9qyrdpnlbs6iswdfa18phfj8zmi8")) + (patches + (search-patches "python-django-tagging-django-4-support.patch")))) (build-system python-build-system) (arguments `(#:phases @@ -1081,6 +1082,8 @@ (define-public python-django-tagging (lambda _ (setenv "DJANGO_SETTINGS_MODULE" "tagging.tests.settings") (invoke "django-admin" "test" "--pythonpath=.")))))) + (native-inputs + (list tzdata-for-tests)) (inputs (list python-django)) (home-page "https://github.com/Fantomas42/django-tagging") diff --git a/gnu/packages/patches/python-django-tagging-django-4-support.patch b/gnu/packages/patches/python-django-tagging-django-4-support.patch new file mode 100644 index 0000000000..bb51f072cf --- /dev/null +++ b/gnu/packages/patches/python-django-tagging-django-4-support.patch @@ -0,0 +1,101 @@ +From ee42fd962c5abc7ed18f729ded42ee1f56397678 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bartolom=C3=A9=20S=C3=A1nchez=20Salado?= + +Date: Sun, 12 Dec 2021 18:13:23 +0100 +Subject: [PATCH 2/4] Use smart_str instead of deprecated smart_text Django + function + +--- + tagging/models.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tagging/models.py b/tagging/models.py +index 02550eec..d16a61ec 100644 +--- a/tagging/models.py ++++ b/tagging/models.py +@@ -5,7 +5,7 @@ + from django.contrib.contenttypes.models import ContentType + from django.db import connection + from django.db import models +-from django.utils.encoding import smart_text ++from django.utils.encoding import smart_str + from django.utils.translation import gettext_lazy as _ + + from tagging import settings +@@ -519,4 +519,4 @@ class Meta: + verbose_name_plural = _('tagged items') + + def __str__(self): +- return '%s [%s]' % (smart_text(self.object), smart_text(self.tag)) ++ return '%s [%s]' % (smart_str(self.object), smart_str(self.tag)) + +From 9c47683ec67ad2fbf82f1dce6384b156f64f55bc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bartolom=C3=A9=20S=C3=A1nchez=20Salado?= + +Date: Sun, 12 Dec 2021 18:14:35 +0100 +Subject: [PATCH 3/4] Use re_path instead of deprecated url Django function + +--- + tagging/tests/urls.py | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tagging/tests/urls.py b/tagging/tests/urls.py +index aa127d5f..7db3e7e1 100644 +--- a/tagging/tests/urls.py ++++ b/tagging/tests/urls.py +@@ -1,5 +1,5 @@ + """Test urls for tagging.""" +-from django.conf.urls import url ++from django.urls import re_path + + from tagging.tests.models import Article + from tagging.views import TaggedObjectList +@@ -11,10 +11,10 @@ class StaticTaggedObjectList(TaggedObjectList): + + + urlpatterns = [ +- url(r'^static/$', StaticTaggedObjectList.as_view()), +- url(r'^static/related/$', StaticTaggedObjectList.as_view( ++ re_path(r'^static/$', StaticTaggedObjectList.as_view()), ++ re_path(r'^static/related/$', StaticTaggedObjectList.as_view( + related_tags=True)), +- url(r'^no-tag/$', TaggedObjectList.as_view(model=Article)), +- url(r'^no-query-no-model/$', TaggedObjectList.as_view()), +- url(r'^(?P[^/]+(?u))/$', TaggedObjectList.as_view(model=Article)), ++ re_path(r'^no-tag/$', TaggedObjectList.as_view(model=Article)), ++ re_path(r'^no-query-no-model/$', TaggedObjectList.as_view()), ++ re_path(r'^(?P[^/]+(?u))/$', TaggedObjectList.as_view(model=Article)), + ] + +From 6550f6c04c0d2d67049e8cc3263623811207c66d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bartolom=C3=A9=20S=C3=A1nchez=20Salado?= + +Date: Sun, 12 Dec 2021 18:26:03 +0100 +Subject: [PATCH 4/4] Add support for Django 4 compatibility + +--- + tagging/models.py | 6 ++++-- + 1 files changed, 4 insertions(+), 2 deletions(-) + +--- a/tagging/models.py ++++ b/tagging/models.py +@@ -5,6 +5,7 @@ + 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_str + from django.utils.translation import gettext_lazy as _ + +@@ -155,8 +156,9 @@ def usage_for_model(self, model, counts=False, min_count=None, + 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 -- 2.40.1