add option to ignore special cases

This commit is contained in:
Matthias Mair 2025-10-14 21:12:40 +02:00
parent f30f41ef5d
commit 016ca1563f
No known key found for this signature in database
GPG Key ID: A593429DDA23B66A
2 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,7 @@ class PathScopedMixin:
"""Mixin to disable a serializer field based on kwargs passed to the view."""
_was_filtered = False
no_filters = False
def __init__(self, *args, **kwargs):
"""Initialization routine for the serializer."""
@ -81,7 +82,7 @@ class PathScopedMixin:
tgs_vals[k] = str2bool(val) if isinstance(val, str) else val
self.filter_target_values = tgs_vals
if len(self.filter_targets) == 0:
if len(self.filter_targets) == 0 and not self.no_filters:
raise Exception(
'INVE-W999: No filter targets found in fields, remove `PathScopedMixin`'
)

View File

@ -340,6 +340,8 @@ class SupplierPartSerializer(
):
"""Serializer for SupplierPart object."""
no_filters = True
export_exclude_fields = ['tags']
export_child_fields = [