community/py3-django-oscar: upgrade to 3.2.2

This commit is contained in:
Kaarle Ritvanen 2023-12-13 17:15:22 +02:00
parent 18d36220ac
commit ec3f2fdeed
3 changed files with 3 additions and 255 deletions

View File

@ -1,39 +0,0 @@
From ef9b7b197b7cbde462293ba62612f6ebfcbafc80 Mon Sep 17 00:00:00 2001
From: Craig Weber <crgwbr@gmail.com>
Date: Wed, 22 Jun 2022 11:36:53 -0400
Subject: [PATCH 1/2] Add Python 3.10 to test suite
---
setup.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/setup.py b/setup.py
index 9ee3d8c69..1a5f1f02c 100755
--- a/setup.py
+++ b/setup.py
@@ -47,11 +47,10 @@ sorl_thumbnail_version = 'sorl-thumbnail>=12.6,<12.7'
easy_thumbnails_version = 'easy-thumbnails>=2.7,<2.8'
docs_requires = [
- 'Sphinx>=4.2,<4.3',
- 'sphinxcontrib-napoleon==0.7',
- 'sphinxcontrib-spelling==7.2.1',
+ 'Sphinx>=5.0',
+ 'sphinxcontrib-spelling==7.5.1',
'sphinx_rtd_theme==1.0.0',
- 'sphinx-issues==1.2.0',
+ 'sphinx-issues==3.0.1',
sorl_thumbnail_version,
easy_thumbnails_version,
]
@@ -109,6 +108,7 @@ setup(
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'Topic :: Software Development :: Libraries :: Application Frameworks']
)
--
2.41.0

View File

@ -1,209 +0,0 @@
From 333f54b1e3c28e35e501c34b181a9eb2ae6cfbdf Mon Sep 17 00:00:00 2001
From: Viggodevries <viggo@highbiza.nl>
Date: Fri, 5 May 2023 17:08:17 +0200
Subject: [PATCH 2/2] Support Django 4.2, remove Python 3.7 support and add
Python 3.11 support
---
setup.py | 17 ++++++++++-------
src/oscar/apps/basket/abstract_models.py | 13 ++++++++-----
src/oscar/apps/catalogue/abstract_models.py | 8 +++++---
src/oscar/apps/dashboard/views.py | 7 +++++++
src/oscar/apps/dashboard/vouchers/views.py | 3 +++
src/oscar/apps/shipping/abstract_models.py | 2 +-
src/oscar/apps/shipping/scales.py | 2 +-
7 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/setup.py b/setup.py
index 1a5f1f02c..97da500cd 100755
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@ sys.path.append(os.path.join(PROJECT_DIR, 'src'))
from oscar import get_version # noqa isort:skip
install_requires = [
- 'django>=3.1,<3.3',
+ 'django>=3.2,<4.3',
# PIL is required for image fields, Pillow is the "friendly" PIL fork
'pillow>=6.0',
# We use the ModelFormSetView from django-extra-views for the basket page
@@ -43,8 +43,8 @@ install_requires = [
'django-widget-tweaks>=1.4.1',
]
-sorl_thumbnail_version = 'sorl-thumbnail>=12.6,<12.7'
-easy_thumbnails_version = 'easy-thumbnails>=2.7,<2.8'
+sorl_thumbnail_version = 'sorl-thumbnail>=12.9,<12.10'
+easy_thumbnails_version = 'easy-thumbnails>=2.7,<2.8.6'
docs_requires = [
'Sphinx>=5.0',
@@ -59,11 +59,12 @@ test_requires = [
'WebTest>=2.0,<2.1',
'coverage>=5.4,<5.5',
'django-webtest>=1.9,<1.10',
- 'psycopg2-binary>=2.8,<2.9',
+ 'psycopg2-binary>=2.8,<2.10',
'pytest-django>=3.7,<3.9',
'pytest-xdist>=2.2,<3',
'tox>=3.21,<4',
'freezegun>=1.1,<2',
+ 'pytz',
sorl_thumbnail_version,
easy_thumbnails_version,
]
@@ -86,7 +87,7 @@ setup(
package_dir={'': 'src'},
packages=find_packages('src'),
include_package_data=True,
- python_requires='>=3.7',
+ python_requires='>=3.8',
install_requires=install_requires,
extras_require={
'docs': docs_requires,
@@ -98,17 +99,19 @@ setup(
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
- 'Framework :: Django :: 3.1',
'Framework :: Django :: 3.2',
+ 'Framework :: Django :: 4.0',
+ 'Framework :: Django :: 4.1',
+ 'Framework :: Django :: 4.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
'Topic :: Software Development :: Libraries :: Application Frameworks']
)
diff --git a/src/oscar/apps/basket/abstract_models.py b/src/oscar/apps/basket/abstract_models.py
index e7fe9ffe1..46d2add66 100644
--- a/src/oscar/apps/basket/abstract_models.py
+++ b/src/oscar/apps/basket/abstract_models.py
@@ -126,7 +126,7 @@ class AbstractBasket(models.Model):
lost.
"""
if self.id is None:
- return self.lines.none()
+ return self.lines.model.objects.none()
if self._lines is None:
self._lines = (
self.lines
@@ -523,7 +523,7 @@ class AbstractBasket(models.Model):
@property
def num_items(self):
"""Return number of items"""
- return sum(line.quantity for line in self.lines.all())
+ return sum(line.quantity for line in self.all_lines())
@property
def num_items_without_discount(self):
@@ -599,9 +599,12 @@ class AbstractBasket(models.Model):
The basket can contain multiple lines with the same product, but
different options and stockrecords. Those quantities are summed up.
"""
- matching_lines = self.lines.filter(product=product)
- quantity = matching_lines.aggregate(Sum('quantity'))['quantity__sum']
- return quantity or 0
+ if self.id:
+ matching_lines = self.lines.filter(product=product)
+ quantity = matching_lines.aggregate(Sum('quantity'))['quantity__sum']
+ return quantity or 0
+
+ return 0
def line_quantity(self, product, stockrecord, options=None):
"""
diff --git a/src/oscar/apps/catalogue/abstract_models.py b/src/oscar/apps/catalogue/abstract_models.py
index 08b893e0b..4a93014f6 100644
--- a/src/oscar/apps/catalogue/abstract_models.py
+++ b/src/oscar/apps/catalogue/abstract_models.py
@@ -220,8 +220,8 @@ class AbstractCategory(MP_Node):
is_public=False, path__rstartswith=OuterRef("path"), depth__lt=OuterRef("depth")
)
self.get_descendants_and_self().update(
- ancestors_are_public=Exists(
- included_in_non_public_subtree.values("id"), negated=True))
+ ancestors_are_public=~Exists(
+ included_in_non_public_subtree.values("id")))
# Correctly populate ancestors_are_public
self.refresh_from_db()
@@ -599,7 +599,9 @@ class AbstractProduct(models.Model):
"""
Test if this product has any stockrecords
"""
- return self.stockrecords.exists()
+ if self.id:
+ return self.stockrecords.exists()
+ return False
@property
def num_stockrecords(self):
diff --git a/src/oscar/apps/dashboard/views.py b/src/oscar/apps/dashboard/views.py
index b555bdd9f..92e9f3b82 100644
--- a/src/oscar/apps/dashboard/views.py
+++ b/src/oscar/apps/dashboard/views.py
@@ -306,6 +306,13 @@ class PopUpWindowDeleteMixin(PopUpWindowMixin):
else:
return response
+ def post(self, request, *args, **kwargs):
+ """
+ Calls the delete() method on the fetched object and then
+ redirects to the success URL, or closes the popup, it it is one.
+ """
+ return self.delete(request, *args, **kwargs)
+
class LoginView(auth_views.LoginView):
template_name = 'oscar/dashboard/login.html'
diff --git a/src/oscar/apps/dashboard/vouchers/views.py b/src/oscar/apps/dashboard/vouchers/views.py
index 57312dbbc..20b79edf1 100644
--- a/src/oscar/apps/dashboard/vouchers/views.py
+++ b/src/oscar/apps/dashboard/vouchers/views.py
@@ -186,6 +186,9 @@ class VoucherDeleteView(generic.DeleteView):
self.object.voucher_set.update_count()
return response
+ def post(self, request, *args, **kwargs):
+ return self.delete(request, *args, **kwargs)
+
def get_success_url(self):
messages.warning(self.request, _("Voucher deleted"))
if self.object.voucher_set is not None:
diff --git a/src/oscar/apps/shipping/abstract_models.py b/src/oscar/apps/shipping/abstract_models.py
index bc89d0c71..7322b088f 100644
--- a/src/oscar/apps/shipping/abstract_models.py
+++ b/src/oscar/apps/shipping/abstract_models.py
@@ -83,7 +83,7 @@ class AbstractOrderAndItemCharges(AbstractBase):
incl_tax=D('0.00'))
charge = self.price_per_order
- for line in basket.lines.all():
+ for line in basket.all_lines():
if line.product.is_shipping_required:
charge += line.quantity * self.price_per_item
diff --git a/src/oscar/apps/shipping/scales.py b/src/oscar/apps/shipping/scales.py
index c62aa0c81..7429828a7 100644
--- a/src/oscar/apps/shipping/scales.py
+++ b/src/oscar/apps/shipping/scales.py
@@ -30,6 +30,6 @@ class Scale(object):
def weigh_basket(self, basket):
weight = D('0.0')
- for line in basket.lines.all():
+ for line in basket.all_lines():
weight += self.weigh_product(line.product) * line.quantity
return weight
--
2.41.0

View File

@ -1,8 +1,8 @@
# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Maintainer: Kaarle Ritvanen <kunkku@alpinelinux.org>
pkgname=py3-django-oscar
pkgver=3.2
pkgrel=3
pkgver=3.2.2
pkgrel=0
pkgdesc="Domain-driven e-commerce for Django"
url="http://oscarcommerce.com/"
arch="noarch"
@ -14,8 +14,6 @@ depends="py3-babel py3-django py3-django-extra-views py3-django-haystack
makedepends="gettext py3-setuptools"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/d/django-oscar/django-oscar-$pkgver.tar.gz
0001-Add-Python-3.10-to-test-suite.patch
0002-Support-Django-4.2-remove-Python-3.7-support-and-add.patch
"
builddir="$srcdir/django-oscar-$pkgver"
@ -40,7 +38,5 @@ package() {
}
sha512sums="
1d12c0069b57653bdd65548f9cc259e6bdc749b8a60888c2686e155aa88c8a4ae41eb78fb217e7e8de36bb38db1e9a8f66cab625bf99163ec2e9be20cb9c0bb1 django-oscar-3.2.tar.gz
c8cb8db783c13aae08c0ff25f522ed8f9163173aa074a90e539d0572a55ae2e0e2300e9a62a3a757fd120d72fa31419ffae939b3a1b9d6dec1a65cb68f910869 0001-Add-Python-3.10-to-test-suite.patch
9cc2aec9dfdc3b80b9c2497627fa0226f07544d6a36a67acc004238545f4fe13a2b5ee511ad95f294e8530b422aec87ba77f49bbe9cd177fbe609e9fbc1b88c4 0002-Support-Django-4.2-remove-Python-3.7-support-and-add.patch
2577f771efc3534a0c35ee4999c17c68941fcb5dfd6001b28b9d5dbcb5151bdb0c22f614bf9e83983f5d9b7df1bf7927e178dbff9db07c0584a98fca5050e5b1 django-oscar-3.2.2.tar.gz
"