summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2024-01-26 12:45:07 +0100
committerGitHub <noreply@github.com>2024-01-26 12:45:07 +0100
commit305757aec19c9d5111e4d76095ae0acd66163e4b (patch)
tree04aa017e66c06b3b19cb466ed4e1d73cd871523d /django/forms
parent3f6d939c62efd967f548c27a265748cc2cc47ca5 (diff)
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py10
-rw-r--r--django/forms/widgets.py22
2 files changed, 20 insertions, 12 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 6a2608c0b3..cd6986d72a 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -2,6 +2,7 @@
Helper functions for creating Form classes from Django models
and database field objects.
"""
+
from itertools import chain
from django.core.exceptions import (
@@ -830,9 +831,12 @@ class BaseModelFormSet(BaseFormSet, AltersData):
)
# Reduce Model instances to their primary key values
row_data = tuple(
- d._get_pk_val() if hasattr(d, "_get_pk_val")
- # Prevent "unhashable type: list" errors later on.
- else tuple(d) if isinstance(d, list) else d
+ (
+ d._get_pk_val()
+ if hasattr(d, "_get_pk_val")
+ # Prevent "unhashable type: list" errors later on.
+ else tuple(d) if isinstance(d, list) else d
+ )
for d in row_data
)
if row_data and None not in row_data:
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index 2c734052d5..4fae110d5e 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -101,9 +101,11 @@ class Media:
def render_js(self):
return [
- path.__html__()
- if hasattr(path, "__html__")
- else format_html('<script src="{}"></script>', self.absolute_path(path))
+ (
+ path.__html__()
+ if hasattr(path, "__html__")
+ else format_html('<script src="{}"></script>', self.absolute_path(path))
+ )
for path in self._js
]
@@ -113,12 +115,14 @@ class Media:
media = sorted(self._css)
return chain.from_iterable(
[
- path.__html__()
- if hasattr(path, "__html__")
- else format_html(
- '<link href="{}" media="{}" rel="stylesheet">',
- self.absolute_path(path),
- medium,
+ (
+ path.__html__()
+ if hasattr(path, "__html__")
+ else format_html(
+ '<link href="{}" media="{}" rel="stylesheet">',
+ self.absolute_path(path),
+ medium,
+ )
)
for path in self._css[medium]
]