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):
# Defines a material design icon associated with this type of model
icon_ = "radio_button_unchecked"
site = models.ForeignKey(Site, on_delete=models.CASCADE,
default=Site.objects.get_current, editable=False)
site = models.ForeignKey(
Site, on_delete=models.CASCADE, default=Site.objects.get_current, editable=False
)
objects = CurrentSiteManager()
objects_all_sites = models.Manager()
......
......@@ -3,16 +3,9 @@ from django.forms import EmailField, ImageField, URLField
from django.utils.translation import gettext_lazy as _
from dynamic_preferences.preferences import Section
from dynamic_preferences.types import (
ChoicePreference,
FilePreference,
StringPreference,
)
from .registries import (
person_preferences_registry,
site_preferences_registry,
)
from dynamic_preferences.types import ChoicePreference, FilePreference, StringPreference
from .registries import person_preferences_registry, site_preferences_registry
from .util.notifications import get_notification_choices_lazy
general = Section("general")
......
......@@ -480,8 +480,7 @@ PWA_APP_SPLASH_SCREEN = [
title="pwa_icon", size=192, rel="apple", default=STATIC_URL + "icons/apple_180.png"
),
"media": (
"(device-width: 320px) and (device-height: 568px) and"
"(-webkit-device-pixel-ratio: 2)"
"(device-width: 320px) and (device-height: 568px) and" "(-webkit-device-pixel-ratio: 2)"
),
}
]
......
......@@ -15,6 +15,7 @@ from .core_helpers import copyright_years
class AppConfig(django.apps.AppConfig):
"""An extended version of DJango's AppConfig container."""
def ready(self):
super().ready()
......
......@@ -10,9 +10,9 @@ from uuid import uuid4
from django.conf import settings
from django.db.models import Model
from django.http import HttpRequest
from django.shortcuts import get_object_or_404
from django.utils import timezone
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:
......@@ -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
aware of dynamic preferences.
"""
def _get_preference(section: str, name: str) -> Any:
return get_site_preferences()[f"{section}__{name}"]
......@@ -125,6 +126,7 @@ def lazy_get_favicon_url(
title: str, size: int, rel: str, default: Optional[str] = None
) -> Callable[[str, str], Any]:
"""Lazily get the URL to a favicon image."""
def _get_favicon_url(size: int, rel: str) -> Any:
from favicon.models import Favicon # noqa
......@@ -220,6 +222,7 @@ def objectgetter_optional(
model: Model, default: Optional[Any] = None, default_eval: bool = False
) -> Callable[[HttpRequest, Optional[int]], Model]:
"""Get an object by pk, defaulting to None."""
def get_object(request: HttpRequest, id_: Optional[int] = None) -> Model:
if id_ is not None:
return get_object_or_404(model, pk=id_)
......
......@@ -380,6 +380,7 @@ def searchbar_snippets(request: HttpRequest) -> HttpResponse:
class PermissionSearchView(PermissionRequiredMixin, SearchView):
"""Wrapper to apply permission to haystack's search view."""
permission_required = "core.search"
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