Upgrading stuff.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Víðir Valberg Guðmundsson 2023-09-18 20:58:30 +02:00
parent beabd49976
commit f1c328a10c
13 changed files with 55 additions and 58 deletions

View file

@ -16,14 +16,13 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit - repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.209' rev: 'v0.0.290'
hooks: hooks:
- id: ruff - id: ruff
args: args:
- --force-exclude
- --fix - --fix
- repo: https://github.com/asottile/reorder_python_imports - repo: https://github.com/asottile/reorder_python_imports
rev: v3.9.0 rev: v3.11.0
hooks: hooks:
- id: reorder-python-imports - id: reorder-python-imports
args: args:
@ -31,33 +30,33 @@ repos:
- --application-directories=.:src - --application-directories=.:src
exclude: migrations/ exclude: migrations/
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v3.3.1 rev: v3.11.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: args:
- --py311-plus - --py311-plus
exclude: migrations/ exclude: migrations/
- repo: https://github.com/adamchainz/django-upgrade - repo: https://github.com/adamchainz/django-upgrade
rev: 1.12.0 rev: 1.14.1
hooks: hooks:
- id: django-upgrade - id: django-upgrade
args: args:
- --target-version=4.1 - --target-version=4.1
- repo: https://github.com/asottile/yesqa - repo: https://github.com/asottile/yesqa
rev: v1.4.0 rev: v1.5.0
hooks: hooks:
- id: yesqa - id: yesqa
- repo: https://github.com/asottile/add-trailing-comma - repo: https://github.com/asottile/add-trailing-comma
rev: v2.4.0 rev: v3.1.0
hooks: hooks:
- id: add-trailing-comma - id: add-trailing-comma
args: args:
- --py36-plus - --py36-plus
- repo: https://github.com/hadialqattan/pycln - repo: https://github.com/hadialqattan/pycln
rev: v2.1.2 rev: v2.2.2
hooks: hooks:
- id: pycln - id: pycln
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 22.12.0 rev: 23.9.1
hooks: hooks:
- id: black - id: black

View file

@ -1,6 +1,6 @@
Django==4.1.5 Django==4.2.5
django-money==1.3 django-money==1.3
django-allauth==0.46 django-allauth==0.56.1
psycopg2-binary==2.9.5 psycopg2-binary==2.9.5
environs[django]==9.3 environs[django]==9.3
uvicorn==0.13 uvicorn==0.13

View file

@ -1,10 +1,10 @@
# #
# This file is autogenerated by pip-compile with Python 3.10 # This file is autogenerated by pip-compile with Python 3.11
# by the following command: # by the following command:
# #
# pip-compile --output-file=requirements/base.txt requirements/base.in # pip-compile --output-file=requirements/base.txt requirements/base.in
# #
asgiref==3.5.2 asgiref==3.7.2
# via django # via django
certifi==2022.9.24 certifi==2022.9.24
# via requests # via requests
@ -22,14 +22,14 @@ dj-database-url==1.0.0
# via environs # via environs
dj-email-url==1.0.6 dj-email-url==1.0.6
# via environs # via environs
django==4.1.5 django==4.2.5
# via # via
# -r requirements/base.in # -r requirements/base.in
# dj-database-url # dj-database-url
# django-allauth # django-allauth
# django-money # django-money
# django-zen-queries # django-zen-queries
django-allauth==0.46 django-allauth==0.56.1
# via -r requirements/base.in # via -r requirements/base.in
django-cache-url==3.4.2 django-cache-url==3.4.2
# via environs # via environs
@ -37,7 +37,7 @@ django-money==1.3
# via -r requirements/base.in # via -r requirements/base.in
django-zen-queries==2.1.0 django-zen-queries==2.1.0
# via -r requirements/base.in # via -r requirements/base.in
environs[django]==9.3 environs[django]==9.3.0
# via -r requirements/base.in # via -r requirements/base.in
h11==0.14.0 h11==0.14.0
# via uvicorn # via uvicorn
@ -73,9 +73,9 @@ sqlparse==0.4.3
# via django # via django
urllib3==1.26.12 urllib3==1.26.12
# via requests # via requests
uvicorn==0.13 uvicorn==0.13.0
# via -r requirements/base.in # via -r requirements/base.in
whitenoise==5.2 whitenoise==5.2.0
# via -r requirements/base.in # via -r requirements/base.in
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:

View file

@ -1,8 +1,8 @@
-r test.txt -r test.txt
django-browser-reload==1.6.0 django-browser-reload==1.11.0
django-debug-toolbar==3.7.0 django-debug-toolbar==4.2.0
django-extensions==3.2.1 django-extensions==3.2.3
django-stubs==1.12.0 django-stubs==1.12.0
ipython==8.6.0 ipython==8.6.0
mypy==0.990 mypy==1.5.1

View file

@ -1,10 +1,10 @@
# #
# This file is autogenerated by pip-compile with Python 3.10 # This file is autogenerated by pip-compile with Python 3.11
# by the following command: # by the following command:
# #
# pip-compile --output-file=requirements/dev.txt requirements/dev.in # pip-compile --output-file=requirements/dev.txt requirements/dev.in
# #
asgiref==3.5.2 asgiref==3.7.2
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# django # django
@ -28,7 +28,7 @@ click==7.1.2
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# uvicorn # uvicorn
coverage==6.5.0 coverage==7.3.1
# via -r requirements/test.txt # via -r requirements/test.txt
cryptography==38.0.3 cryptography==38.0.3
# via # via
@ -48,7 +48,7 @@ dj-email-url==1.0.6
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# environs # environs
django==4.1.5 django==4.2.5
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# dj-database-url # dj-database-url
@ -60,17 +60,17 @@ django==4.1.5
# django-stubs # django-stubs
# django-stubs-ext # django-stubs-ext
# django-zen-queries # django-zen-queries
django-allauth==0.46 django-allauth==0.56.1
# via -r requirements/test.txt # via -r requirements/test.txt
django-browser-reload==1.6.0 django-browser-reload==1.11.0
# via -r requirements/dev.in # via -r requirements/dev.in
django-cache-url==3.4.2 django-cache-url==3.4.2
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# environs # environs
django-debug-toolbar==3.7.0 django-debug-toolbar==4.2.0
# via -r requirements/dev.in # via -r requirements/dev.in
django-extensions==3.2.1 django-extensions==3.2.3
# via -r requirements/dev.in # via -r requirements/dev.in
django-money==1.3 django-money==1.3
# via -r requirements/test.txt # via -r requirements/test.txt
@ -80,7 +80,7 @@ django-stubs-ext==0.7.0
# via django-stubs # via django-stubs
django-zen-queries==2.1.0 django-zen-queries==2.1.0
# via -r requirements/test.txt # via -r requirements/test.txt
environs[django]==9.3 environs[django]==9.3.0
# via -r requirements/test.txt # via -r requirements/test.txt
executing==1.2.0 executing==1.2.0
# via stack-data # via stack-data
@ -106,11 +106,11 @@ marshmallow==3.19.0
# environs # environs
matplotlib-inline==0.1.6 matplotlib-inline==0.1.6
# via ipython # via ipython
mypy==0.990 mypy==1.5.1
# via # via
# -r requirements/dev.in # -r requirements/dev.in
# django-stubs # django-stubs
mypy-extensions==0.4.3 mypy-extensions==1.0.0
# via mypy # via mypy
oauthlib==3.2.2 oauthlib==3.2.2
# via # via
@ -178,12 +178,10 @@ sqlparse==0.4.3
# django-debug-toolbar # django-debug-toolbar
stack-data==0.6.1 stack-data==0.6.1
# via ipython # via ipython
tblib==1.7.0 tblib==2.0.0
# via -r requirements/test.txt # via -r requirements/test.txt
tomli==2.0.1 tomli==2.0.1
# via # via django-stubs
# django-stubs
# mypy
traitlets==5.5.0 traitlets==5.5.0
# via # via
# ipython # ipython
@ -203,11 +201,11 @@ urllib3==1.26.12
# via # via
# -r requirements/test.txt # -r requirements/test.txt
# requests # requests
uvicorn==0.13 uvicorn==0.13.0
# via -r requirements/test.txt # via -r requirements/test.txt
wcwidth==0.2.5 wcwidth==0.2.5
# via prompt-toolkit # via prompt-toolkit
whitenoise==5.2 whitenoise==5.2.0
# via -r requirements/test.txt # via -r requirements/test.txt
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:

View file

@ -1,5 +1,5 @@
-r base.txt -r base.txt
coverage==6.5.0 coverage==7.3.1
tblib==1.7.0 tblib==2.0.0
unittest-xml-reporting==3.2.0 unittest-xml-reporting==3.2.0

View file

@ -1,10 +1,10 @@
# #
# This file is autogenerated by pip-compile with Python 3.10 # This file is autogenerated by pip-compile with Python 3.11
# by the following command: # by the following command:
# #
# pip-compile --output-file=requirements/test.txt requirements/test.in # pip-compile --output-file=requirements/test.txt requirements/test.in
# #
asgiref==3.5.2 asgiref==3.7.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# django # django
@ -24,7 +24,7 @@ click==7.1.2
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# uvicorn # uvicorn
coverage==6.5.0 coverage==7.3.1
# via -r requirements/test.in # via -r requirements/test.in
cryptography==38.0.3 cryptography==38.0.3
# via # via
@ -42,14 +42,14 @@ dj-email-url==1.0.6
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# environs # environs
django==4.1.5 django==4.2.5
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# dj-database-url # dj-database-url
# django-allauth # django-allauth
# django-money # django-money
# django-zen-queries # django-zen-queries
django-allauth==0.46 django-allauth==0.56.1
# via -r requirements/base.txt # via -r requirements/base.txt
django-cache-url==3.4.2 django-cache-url==3.4.2
# via # via
@ -59,7 +59,7 @@ django-money==1.3
# via -r requirements/base.txt # via -r requirements/base.txt
django-zen-queries==2.1.0 django-zen-queries==2.1.0
# via -r requirements/base.txt # via -r requirements/base.txt
environs[django]==9.3 environs[django]==9.3.0
# via -r requirements/base.txt # via -r requirements/base.txt
h11==0.14.0 h11==0.14.0
# via # via
@ -122,7 +122,7 @@ sqlparse==0.4.3
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# django # django
tblib==1.7.0 tblib==2.0.0
# via -r requirements/test.in # via -r requirements/test.in
unittest-xml-reporting==3.2.0 unittest-xml-reporting==3.2.0
# via -r requirements/test.in # via -r requirements/test.in
@ -130,9 +130,9 @@ urllib3==1.26.12
# via # via
# -r requirements/base.txt # -r requirements/base.txt
# requests # requests
uvicorn==0.13 uvicorn==0.13.0
# via -r requirements/base.txt # via -r requirements/base.txt
whitenoise==5.2 whitenoise==5.2.0
# via -r requirements/base.txt # via -r requirements/base.txt
# The following packages are considered to be unsafe in a requirements file: # The following packages are considered to be unsafe in a requirements file:

View file

@ -6,7 +6,6 @@ from . import models
@admin.register(models.Order) @admin.register(models.Order)
class OrderAdmin(admin.ModelAdmin): class OrderAdmin(admin.ModelAdmin):
list_display = ("who", "description", "created", "is_paid") list_display = ("who", "description", "created", "is_paid")
@admin.display(description=_("Customer")) @admin.display(description=_("Customer"))
@ -16,7 +15,6 @@ class OrderAdmin(admin.ModelAdmin):
@admin.register(models.Payment) @admin.register(models.Payment)
class PaymentAdmin(admin.ModelAdmin): class PaymentAdmin(admin.ModelAdmin):
list_display = ("who", "description", "order_id", "created") list_display = ("who", "description", "order_id", "created")
@admin.display(description=_("Customer")) @admin.display(description=_("Customer"))

View file

@ -9,7 +9,6 @@ from djmoney.models.fields import MoneyField
class CreatedModifiedAbstract(models.Model): class CreatedModifiedAbstract(models.Model):
modified = models.DateTimeField(auto_now=True, verbose_name=_("modified")) modified = models.DateTimeField(auto_now=True, verbose_name=_("modified"))
created = models.DateTimeField(auto_now_add=True, verbose_name=_("created")) created = models.DateTimeField(auto_now_add=True, verbose_name=_("created"))
@ -97,7 +96,6 @@ class Order(CreatedModifiedAbstract):
class Payment(CreatedModifiedAbstract): class Payment(CreatedModifiedAbstract):
amount = MoneyField(max_digits=16, decimal_places=2) amount = MoneyField(max_digits=16, decimal_places=2)
order = models.ForeignKey(Order, on_delete=models.PROTECT) order = models.ForeignKey(Order, on_delete=models.PROTECT)

View file

@ -12,13 +12,18 @@ from utils.mixins import CreatedModifiedAbstract
class Member(User): class Member(User):
class QuerySet(models.QuerySet): class QuerySet(models.QuerySet):
def annotate_membership(self): def annotate_membership(self):
from membership.selectors import get_current_subscription_period from .selectors import get_current_subscription_period
current_subscription_period = get_current_subscription_period()
if not current_subscription_period:
raise ValueError("No current subscription period found")
return self.annotate( return self.annotate(
active_membership=models.Exists( active_membership=models.Exists(
Membership.objects.filter( Membership.objects.filter(
user=models.OuterRef("pk"), user=models.OuterRef("pk"),
period=get_current_subscription_period().id, period=current_subscription_period.id,
), ),
), ),
) )

View file

@ -27,7 +27,6 @@ class Permission:
return f"{self.app_label}.{self.codename}" return f"{self.app_label}.{self.codename}"
def persist_permission(self): def persist_permission(self):
content_type, _ = ContentType.objects.get_or_create( content_type, _ = ContentType.objects.get_or_create(
app_label=self.app_label, app_label=self.app_label,
model=self.model, model=self.model,

View file

@ -65,6 +65,7 @@ MIDDLEWARE = [
"django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware", "django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware",
"allauth.account.middleware.AccountMiddleware",
] ]
ROOT_URLCONF = "project.urls" ROOT_URLCONF = "project.urls"

View file

@ -3,7 +3,6 @@ from django.utils.translation import gettext_lazy as _
class CreatedModifiedAbstract(models.Model): class CreatedModifiedAbstract(models.Model):
modified = models.DateTimeField(auto_now=True, verbose_name=_("modified")) modified = models.DateTimeField(auto_now=True, verbose_name=_("modified"))
created = models.DateTimeField(auto_now_add=True, verbose_name=_("created")) created = models.DateTimeField(auto_now_add=True, verbose_name=_("created"))