Skip to content

Commit 31c1998

Browse files
committed
remove unneeded defaults for postprocessor opts
1 parent b0e2c03 commit 31c1998

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/django_idom/hooks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,10 @@ def _postprocess_django_query(data: QuerySet | Model, options: dict[str, Any]) -
255255
with contextlib.suppress(AttributeError):
256256
getattr(data, field.name)
257257

258-
if options.get("many_to_one", None) and type(field) == ManyToOneRel:
258+
if options.get("many_to_one", False) and type(field) == ManyToOneRel:
259259
prefetch_fields.append(f"{field.name}_set")
260260

261-
elif options.get("many_to_many", None) and isinstance(
261+
elif options.get("many_to_many", False) and isinstance(
262262
field, ManyToManyField
263263
):
264264
prefetch_fields.append(field.name)

src/django_idom/types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ class ViewComponentIframe:
5757
class QueryOptions:
5858
"""Configuration options that can be provided to `use_query`."""
5959

60-
postprocessor_options: dict[str, Any] = field(
61-
default_factory=lambda: {"many_to_many": False, "many_to_one": False}
62-
)
60+
postprocessor_options: dict[str, Any] = field(default_factory=lambda: {})
6361
"""Configuration values usable by the `postprocessor`."""
6462

6563
postprocessor: Callable[[_Data, QueryOptions], None] | None = None

0 commit comments

Comments
 (0)