More linting.

This commit is contained in:
Víðir Valberg Guðmundsson 2024-02-29 21:30:11 +01:00
parent 1b65558608
commit cf3c84b8d9
9 changed files with 19 additions and 14 deletions

View file

@ -88,7 +88,7 @@ class Order(CreatedModifiedAbstract):
verbose_name = pgettext_lazy("accounting term", "Order")
verbose_name_plural = pgettext_lazy("accounting term", "Orders")
def __str__(self):
def __str__(self) -> str:
return f"Order ID {self.display_id}"
@ -113,7 +113,7 @@ class Payment(CreatedModifiedAbstract):
description=order.description,
)
def __str__(self):
def __str__(self) -> str:
return f"Payment ID {self.display_id}"
class Meta:

View file

@ -9,7 +9,7 @@ from . import models
@pytest.mark.django_db()
def test_balance():
def test_balance() -> None:
user = User.objects.create_user("test", "lala@adas.com", "1234")
account = models.Account.objects.create(owner=user)
assert account.balance == 0

View file

@ -1,4 +1,4 @@
"""Membership application
"""Membership application.
======================
This application's domain relate to organizational structures and

View file

@ -5,7 +5,7 @@ from django.db.models.signals import post_migrate
class MembershipConfig(AppConfig):
name = "membership"
def ready(self):
def ready(self) -> None:
from .permissions import persist_permissions
post_migrate.connect(persist_permissions, sender=self)

View file

@ -48,7 +48,7 @@ class SubscriptionPeriod(CreatedModifiedAbstract):
),
]
def __str__(self):
def __str__(self) -> str:
return f"{self.period.lower} - {self.period.upper or _('next general assembly')}"
@ -94,7 +94,7 @@ class Membership(CreatedModifiedAbstract):
on_delete=models.PROTECT,
)
def __str__(self):
def __str__(self) -> str:
return f"{self.user} - {self.period}"
@ -109,5 +109,5 @@ class MembershipType(CreatedModifiedAbstract):
name = models.CharField(verbose_name=_("name"), max_length=64)
def __str__(self):
def __str__(self) -> str:
return self.name

View file

@ -7,7 +7,7 @@ from django.utils.translation import gettext_lazy as _
PERMISSIONS = []
def persist_permissions(sender, **kwargs):
def persist_permissions(sender, **kwargs) -> None:
for permission in PERMISSIONS:
permission.persist_permission()
@ -23,10 +23,10 @@ class Permission:
PERMISSIONS.append(self)
@property
def path(self):
def path(self) -> str:
return f"{self.app_label}.{self.codename}"
def persist_permission(self):
def persist_permission(self) -> None:
content_type, _ = ContentType.objects.get_or_create(
app_label=self.app_label,
model=self.model,

View file

@ -1,4 +1,4 @@
"""URLs for the membersystem"""
"""URLs for the membersystem."""
from django.conf import settings
from django.contrib import admin
from django.urls import include
@ -15,4 +15,5 @@ if settings.DEBUG:
urlpatterns = [
path("__debug__/", include("debug_toolbar.urls")),
path("__reload__/", include("django_browser_reload.urls")),
] + urlpatterns
*urlpatterns,
]

View file

@ -18,3 +18,4 @@ def active_path(context, path_name, class_name) -> str | None:
if is_path or is_base_path:
return class_name
return None

View file

@ -1,17 +1,20 @@
import contextlib
from dataclasses import dataclass
from typing import TYPE_CHECKING
from typing import Any
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import FieldError
from django.core.paginator import Paginator
from django.db.models import Model
from django.http import HttpRequest
from django.http import HttpResponse
from django.urls import reverse
from zen_queries import queries_disabled
from zen_queries import render as zen_queries_render
if TYPE_CHECKING:
from django.db.models import Model
@dataclass
class Row: