[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-04-15 17:43:22 +00:00 committed by Petr Dlouhý
parent 8e7bc05fd3
commit 91d9a8bbd7
23 changed files with 31 additions and 6 deletions

View file

@ -1,4 +1,5 @@
"""Django categories.""" """Django categories."""
__version__ = "1.9.2" __version__ = "1.9.2"

View file

@ -1,4 +1,5 @@
"""Admin interface classes.""" """Admin interface classes."""
from django import forms from django import forms
from django.contrib import admin from django.contrib import admin
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _

View file

@ -1,4 +1,5 @@
"""Django application setup.""" """Django application setup."""
from django.apps import AppConfig from django.apps import AppConfig

View file

@ -3,6 +3,7 @@ This is the base class on which to build a hierarchical category-like model.
It provides customizable metadata and its own name space. It provides customizable metadata and its own name space.
""" """
from django import forms from django import forms
from django.contrib import admin from django.contrib import admin
from django.db import models from django.db import models

View file

@ -1,4 +1,5 @@
"""Settings management for the editor.""" """Settings management for the editor."""
from django.conf import settings from django.conf import settings
STATIC_URL = getattr(settings, "STATIC_URL", settings.MEDIA_URL) STATIC_URL = getattr(settings, "STATIC_URL", settings.MEDIA_URL)

View file

@ -1,4 +1,5 @@
"""Template tags used to render the tree editor.""" """Template tags used to render the tree editor."""
from django.contrib.admin.templatetags.admin_list import _boolean_icon, result_headers from django.contrib.admin.templatetags.admin_list import _boolean_icon, result_headers
from django.contrib.admin.utils import lookup_field from django.contrib.admin.utils import lookup_field
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
@ -89,12 +90,14 @@ def items_for_tree_result(cl, result, form):
table_tag, table_tag,
row_class, row_class,
url, url,
format_html( (
' onclick="opener.dismissRelatedLookupPopup(window, ' ''{}'); return false;"', format_html(
result_id, ' onclick="opener.dismissRelatedLookupPopup(window, ' ''{}'); return false;"',
) result_id,
if cl.is_popup )
else "", if cl.is_popup
else ""
),
result_repr, result_repr,
table_tag, table_tag,
) )

View file

@ -1,4 +1,5 @@
"""Classes for representing tree structures in Django's admin.""" """Classes for representing tree structures in Django's admin."""
from typing import Any from typing import Any
import django import django

View file

@ -1,6 +1,7 @@
""" """
Provides compatibility with Django 1.8. Provides compatibility with Django 1.8.
""" """
from django.contrib.admin.utils import display_for_field as _display_for_field from django.contrib.admin.utils import display_for_field as _display_for_field

View file

@ -1,4 +1,5 @@
"""Custom category fields for other models.""" """Custom category fields for other models."""
from django.db.models import ForeignKey, ManyToManyField from django.db.models import ForeignKey, ManyToManyField

View file

@ -1,4 +1,5 @@
"""Special helpers for generic collections.""" """Special helpers for generic collections."""
import json import json
from django.contrib import admin from django.contrib import admin

View file

@ -1,4 +1,5 @@
"""The add_category_fields command.""" """The add_category_fields command."""
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand

View file

@ -1,4 +1,5 @@
"""Alter one or more models' tables with the registered attributes.""" """Alter one or more models' tables with the registered attributes."""
from django.core.management.base import BaseCommand, CommandError from django.core.management.base import BaseCommand, CommandError

View file

@ -1,4 +1,5 @@
"""Adds and removes category relations on the database.""" """Adds and removes category relations on the database."""
from django.apps import apps from django.apps import apps
from django.db import DatabaseError, connection, transaction from django.db import DatabaseError, connection, transaction
from django.db.utils import OperationalError, ProgrammingError from django.db.utils import OperationalError, ProgrammingError

View file

@ -1,4 +1,5 @@
"""Category models.""" """Category models."""
from functools import reduce from functools import reduce
from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey

View file

@ -1,6 +1,7 @@
""" """
These functions handle the adding of fields to other models. These functions handle the adding of fields to other models.
""" """
from typing import Optional, Type, Union from typing import Optional, Type, Union
from collections.abc import Iterable from collections.abc import Iterable

View file

@ -1,4 +1,5 @@
"""Manages settings for the categories application.""" """Manages settings for the categories application."""
import collections import collections
from django.conf import settings from django.conf import settings

View file

@ -1,4 +1,5 @@
"""Template tags for categories.""" """Template tags for categories."""
from typing import Any, Type, Union from typing import Any, Type, Union
from django import template from django import template

View file

@ -1,4 +1,5 @@
"""URL patterns for the categories app.""" """URL patterns for the categories app."""
from django.urls import path, re_path from django.urls import path, re_path
from django.views.generic import ListView from django.views.generic import ListView

View file

@ -1,4 +1,5 @@
"""View functions for categories.""" """View functions for categories."""
from typing import Optional from typing import Optional
from django.http import Http404, HttpResponse from django.http import Http404, HttpResponse

View file

@ -1,4 +1,5 @@
"""Django settings for sample project.""" """Django settings for sample project."""
import os import os
import sys import sys

View file

@ -1,4 +1,5 @@
"""Admin interface for simple text.""" """Admin interface for simple text."""
from django.contrib import admin from django.contrib import admin
from categories.admin import CategoryBaseAdmin, CategoryBaseAdminForm from categories.admin import CategoryBaseAdmin, CategoryBaseAdminForm

View file

@ -1,4 +1,5 @@
"""Example model.""" """Example model."""
from django.db import models from django.db import models
from categories.base import CategoryBase from categories.base import CategoryBase

View file

@ -1,4 +1,5 @@
"""URL patterns for the example project.""" """URL patterns for the example project."""
import os import os
from django.conf.urls import include from django.conf.urls import include