Ran pre-commit run --all-files.
This commit is contained in:
parent
c9b0c19fec
commit
d31d31485c
9 changed files with 13 additions and 12 deletions
|
@ -36,7 +36,7 @@ class BaseEmail(EmailMessage):
|
||||||
template = "membership/email/base.txt"
|
template = "membership/email/base.txt"
|
||||||
# Optional: Set to a template path for subject
|
# Optional: Set to a template path for subject
|
||||||
template_subject = None
|
template_subject = None
|
||||||
default_subject : StrOrPromise = "SET SUBJECT HERE"
|
default_subject: StrOrPromise = "SET SUBJECT HERE"
|
||||||
|
|
||||||
def __init__(self, request: HttpRequest, *args, **kwargs) -> None: # noqa: ANN002, ANN003
|
def __init__(self, request: HttpRequest, *args, **kwargs) -> None: # noqa: ANN002, ANN003
|
||||||
self.context = kwargs.pop("context", {})
|
self.context = kwargs.pop("context", {})
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission as DjangoPermission
|
from django.contrib.auth.models import Permission as DjangoPermission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
@ -12,7 +12,7 @@ from django.utils.translation import gettext_lazy as _
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django_stubs_ext import StrOrPromise
|
from django_stubs_ext import StrOrPromise
|
||||||
|
|
||||||
PERMISSIONS : list[Permission] = []
|
PERMISSIONS: list[Permission] = []
|
||||||
|
|
||||||
|
|
||||||
def persist_permissions(*args, **kwargs) -> None: # type: ignore[no-untyped-def] # noqa: ANN002, ANN003
|
def persist_permissions(*args, **kwargs) -> None: # type: ignore[no-untyped-def] # noqa: ANN002, ANN003
|
||||||
|
|
|
@ -25,9 +25,9 @@ from .selectors import get_memberships
|
||||||
from .selectors import get_subscription_periods
|
from .selectors import get_subscription_periods
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from utils.types import AuthenticatedHttpRequest
|
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
from utils.types import AuthenticatedHttpRequest
|
||||||
|
|
||||||
member_view = namespaced_decorator_factory(namespace="member", base_path="membership")
|
member_view = namespaced_decorator_factory(namespace="member", base_path="membership")
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ AUTHENTICATION_BACKENDS = (
|
||||||
WSGI_APPLICATION = "project.wsgi.application"
|
WSGI_APPLICATION = "project.wsgi.application"
|
||||||
|
|
||||||
|
|
||||||
AUTH_PASSWORD_VALIDATORS : list[dict[str, str]] = []
|
AUTH_PASSWORD_VALIDATORS: list[dict[str, str]] = []
|
||||||
|
|
||||||
LANGUAGE_CODE = "da-dk"
|
LANGUAGE_CODE = "da-dk"
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ class ServiceInterface(Interface):
|
||||||
|
|
||||||
request_types: list[ServiceRequests] = DEFAULT_SERVICE_REQUEST_TYPES
|
request_types: list[ServiceRequests] = DEFAULT_SERVICE_REQUEST_TYPES
|
||||||
|
|
||||||
subscribe_fields: tuple[tuple[str, forms.Field],...] = ()
|
subscribe_fields: tuple[tuple[str, forms.Field], ...] = ()
|
||||||
|
|
||||||
def get_form_class(self) -> type:
|
def get_form_class(self) -> type:
|
||||||
"""Get the form class for the service."""
|
"""Get the form class for the service."""
|
||||||
|
|
|
@ -14,8 +14,8 @@ from services.registry import ServiceRegistry
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from utils.types import AuthenticatedHttpRequest
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
from utils.types import AuthenticatedHttpRequest
|
||||||
|
|
||||||
services_view = namespaced_decorator_factory(
|
services_view = namespaced_decorator_factory(
|
||||||
namespace="services",
|
namespace="services",
|
||||||
|
@ -34,7 +34,9 @@ def services_overview(request: AuthenticatedHttpRequest) -> HttpResponse:
|
||||||
|
|
||||||
active_service_classes = [service.__class__ for service in active_services]
|
active_service_classes = [service.__class__ for service in active_services]
|
||||||
|
|
||||||
non_active_services = [service for _, service in ServiceRegistry.get_items() if service not in active_service_classes]
|
non_active_services = [
|
||||||
|
service for _, service in ServiceRegistry.get_items() if service not in active_service_classes
|
||||||
|
]
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"non_active_services": non_active_services,
|
"non_active_services": non_active_services,
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
"""Command to bootstrap development data."""
|
"""Command to bootstrap development data."""
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from django.utils import timezone
|
|
||||||
from django.db.backends.postgresql.psycopg_any import DateRange
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
|
from django.db.backends.postgresql.psycopg_any import DateRange
|
||||||
|
from django.utils import timezone
|
||||||
from membership.models import SubscriptionPeriod
|
from membership.models import SubscriptionPeriod
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,5 +7,4 @@ from django.http import HttpRequest
|
||||||
class AuthenticatedHttpRequest(HttpRequest):
|
class AuthenticatedHttpRequest(HttpRequest):
|
||||||
"""HttpRequest with an authenticated user."""
|
"""HttpRequest with an authenticated user."""
|
||||||
|
|
||||||
# XXX(reynir): Should this be Member instead?!
|
|
||||||
user: User
|
user: User
|
||||||
|
|
|
@ -89,7 +89,6 @@ class RenderConfig:
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
with queries_disabled():
|
with queries_disabled():
|
||||||
row = Row(
|
row = Row(
|
||||||
# XXX(reynir): we never use the key
|
|
||||||
data={column[0]: getattr(obj, column[0]) for column in columns},
|
data={column[0]: getattr(obj, column[0]) for column in columns},
|
||||||
actions=[action.render(obj) for action in row_actions],
|
actions=[action.render(obj) for action in row_actions],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue