Skip to content
Snippets Groups Projects
Verified Commit 391a3276 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

[Reformat] black again

parent 4adffbd6
No related branches found
No related tags found
No related merge requests found
...@@ -65,8 +65,9 @@ class ExtensibleModel(models.Model): ...@@ -65,8 +65,9 @@ class ExtensibleModel(models.Model):
# Defines a material design icon associated with this type of model # Defines a material design icon associated with this type of model
icon_ = "radio_button_unchecked" icon_ = "radio_button_unchecked"
site = models.ForeignKey(Site, on_delete=models.CASCADE, site = models.ForeignKey(
default=Site.objects.get_current, editable=False) Site, on_delete=models.CASCADE, default=Site.objects.get_current, editable=False
)
objects = CurrentSiteManager() objects = CurrentSiteManager()
objects_all_sites = models.Manager() objects_all_sites = models.Manager()
......
...@@ -3,16 +3,9 @@ from django.forms import EmailField, ImageField, URLField ...@@ -3,16 +3,9 @@ from django.forms import EmailField, ImageField, URLField
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from dynamic_preferences.preferences import Section from dynamic_preferences.preferences import Section
from dynamic_preferences.types import ( from dynamic_preferences.types import ChoicePreference, FilePreference, StringPreference
ChoicePreference,
FilePreference, from .registries import person_preferences_registry, site_preferences_registry
StringPreference,
)
from .registries import (
person_preferences_registry,
site_preferences_registry,
)
from .util.notifications import get_notification_choices_lazy from .util.notifications import get_notification_choices_lazy
general = Section("general") general = Section("general")
......
...@@ -480,8 +480,7 @@ PWA_APP_SPLASH_SCREEN = [ ...@@ -480,8 +480,7 @@ PWA_APP_SPLASH_SCREEN = [
title="pwa_icon", size=192, rel="apple", default=STATIC_URL + "icons/apple_180.png" title="pwa_icon", size=192, rel="apple", default=STATIC_URL + "icons/apple_180.png"
), ),
"media": ( "media": (
"(device-width: 320px) and (device-height: 568px) and" "(device-width: 320px) and (device-height: 568px) and" "(-webkit-device-pixel-ratio: 2)"
"(-webkit-device-pixel-ratio: 2)"
), ),
} }
] ]
......
...@@ -15,6 +15,7 @@ from .core_helpers import copyright_years ...@@ -15,6 +15,7 @@ from .core_helpers import copyright_years
class AppConfig(django.apps.AppConfig): class AppConfig(django.apps.AppConfig):
"""An extended version of DJango's AppConfig container.""" """An extended version of DJango's AppConfig container."""
def ready(self): def ready(self):
super().ready() super().ready()
......
...@@ -10,9 +10,9 @@ from uuid import uuid4 ...@@ -10,9 +10,9 @@ from uuid import uuid4
from django.conf import settings from django.conf import settings
from django.db.models import Model from django.db.models import Model
from django.http import HttpRequest from django.http import HttpRequest
from django.shortcuts import get_object_or_404
from django.utils import timezone from django.utils import timezone
from django.utils.functional import lazy from django.utils.functional import lazy
from django.shortcuts import get_object_or_404
def copyright_years(years: Sequence[int], seperator: str = ", ", joiner: str = "") -> str: def copyright_years(years: Sequence[int], seperator: str = ", ", joiner: str = "") -> str:
...@@ -113,6 +113,7 @@ def lazy_preference(section: str, name: str) -> Callable[[str, str], Any]: ...@@ -113,6 +113,7 @@ def lazy_preference(section: str, name: str) -> Callable[[str, str], Any]:
to other global settings to make them available to third-party apps that are not to other global settings to make them available to third-party apps that are not
aware of dynamic preferences. aware of dynamic preferences.
""" """
def _get_preference(section: str, name: str) -> Any: def _get_preference(section: str, name: str) -> Any:
return get_site_preferences()[f"{section}__{name}"] return get_site_preferences()[f"{section}__{name}"]
...@@ -125,6 +126,7 @@ def lazy_get_favicon_url( ...@@ -125,6 +126,7 @@ def lazy_get_favicon_url(
title: str, size: int, rel: str, default: Optional[str] = None title: str, size: int, rel: str, default: Optional[str] = None
) -> Callable[[str, str], Any]: ) -> Callable[[str, str], Any]:
"""Lazily get the URL to a favicon image.""" """Lazily get the URL to a favicon image."""
def _get_favicon_url(size: int, rel: str) -> Any: def _get_favicon_url(size: int, rel: str) -> Any:
from favicon.models import Favicon # noqa from favicon.models import Favicon # noqa
...@@ -220,6 +222,7 @@ def objectgetter_optional( ...@@ -220,6 +222,7 @@ def objectgetter_optional(
model: Model, default: Optional[Any] = None, default_eval: bool = False model: Model, default: Optional[Any] = None, default_eval: bool = False
) -> Callable[[HttpRequest, Optional[int]], Model]: ) -> Callable[[HttpRequest, Optional[int]], Model]:
"""Get an object by pk, defaulting to None.""" """Get an object by pk, defaulting to None."""
def get_object(request: HttpRequest, id_: Optional[int] = None) -> Model: def get_object(request: HttpRequest, id_: Optional[int] = None) -> Model:
if id_ is not None: if id_ is not None:
return get_object_or_404(model, pk=id_) return get_object_or_404(model, pk=id_)
......
...@@ -380,6 +380,7 @@ def searchbar_snippets(request: HttpRequest) -> HttpResponse: ...@@ -380,6 +380,7 @@ def searchbar_snippets(request: HttpRequest) -> HttpResponse:
class PermissionSearchView(PermissionRequiredMixin, SearchView): class PermissionSearchView(PermissionRequiredMixin, SearchView):
"""Wrapper to apply permission to haystack's search view.""" """Wrapper to apply permission to haystack's search view."""
permission_required = "core.search" permission_required = "core.search"
def create_response(self): def create_response(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment