Upgrading stuff.

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

View file

@ -1,6 +1,6 @@
Django==4.1.5
Django==4.2.5
django-money==1.3
django-allauth==0.46
django-allauth==0.56.1
psycopg2-binary==2.9.5
environs[django]==9.3
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:
#
# pip-compile --output-file=requirements/base.txt requirements/base.in
#
asgiref==3.5.2
asgiref==3.7.2
# via django
certifi==2022.9.24
# via requests
@ -22,14 +22,14 @@ dj-database-url==1.0.0
# via environs
dj-email-url==1.0.6
# via environs
django==4.1.5
django==4.2.5
# via
# -r requirements/base.in
# dj-database-url
# django-allauth
# django-money
# django-zen-queries
django-allauth==0.46
django-allauth==0.56.1
# via -r requirements/base.in
django-cache-url==3.4.2
# via environs
@ -37,7 +37,7 @@ django-money==1.3
# via -r requirements/base.in
django-zen-queries==2.1.0
# via -r requirements/base.in
environs[django]==9.3
environs[django]==9.3.0
# via -r requirements/base.in
h11==0.14.0
# via uvicorn
@ -73,9 +73,9 @@ sqlparse==0.4.3
# via django
urllib3==1.26.12
# via requests
uvicorn==0.13
uvicorn==0.13.0
# via -r requirements/base.in
whitenoise==5.2
whitenoise==5.2.0
# via -r requirements/base.in
# The following packages are considered to be unsafe in a requirements file:

View file

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

View file

@ -1,5 +1,5 @@
-r base.txt
coverage==6.5.0
tblib==1.7.0
coverage==7.3.1
tblib==2.0.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:
#
# pip-compile --output-file=requirements/test.txt requirements/test.in
#
asgiref==3.5.2
asgiref==3.7.2
# via
# -r requirements/base.txt
# django
@ -24,7 +24,7 @@ click==7.1.2
# via
# -r requirements/base.txt
# uvicorn
coverage==6.5.0
coverage==7.3.1
# via -r requirements/test.in
cryptography==38.0.3
# via
@ -42,14 +42,14 @@ dj-email-url==1.0.6
# via
# -r requirements/base.txt
# environs
django==4.1.5
django==4.2.5
# via
# -r requirements/base.txt
# dj-database-url
# django-allauth
# django-money
# django-zen-queries
django-allauth==0.46
django-allauth==0.56.1
# via -r requirements/base.txt
django-cache-url==3.4.2
# via
@ -59,7 +59,7 @@ django-money==1.3
# via -r requirements/base.txt
django-zen-queries==2.1.0
# via -r requirements/base.txt
environs[django]==9.3
environs[django]==9.3.0
# via -r requirements/base.txt
h11==0.14.0
# via
@ -122,7 +122,7 @@ sqlparse==0.4.3
# via
# -r requirements/base.txt
# django
tblib==1.7.0
tblib==2.0.0
# via -r requirements/test.in
unittest-xml-reporting==3.2.0
# via -r requirements/test.in
@ -130,9 +130,9 @@ urllib3==1.26.12
# via
# -r requirements/base.txt
# requests
uvicorn==0.13
uvicorn==0.13.0
# via -r requirements/base.txt
whitenoise==5.2
whitenoise==5.2.0
# via -r requirements/base.txt
# 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)
class OrderAdmin(admin.ModelAdmin):
list_display = ("who", "description", "created", "is_paid")
@admin.display(description=_("Customer"))
@ -16,7 +15,6 @@ class OrderAdmin(admin.ModelAdmin):
@admin.register(models.Payment)
class PaymentAdmin(admin.ModelAdmin):
list_display = ("who", "description", "order_id", "created")
@admin.display(description=_("Customer"))

View file

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

View file

@ -12,13 +12,18 @@ from utils.mixins import CreatedModifiedAbstract
class Member(User):
class QuerySet(models.QuerySet):
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(
active_membership=models.Exists(
Membership.objects.filter(
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}"
def persist_permission(self):
content_type, _ = ContentType.objects.get_or_create(
app_label=self.app_label,
model=self.model,

View file

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

View file

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