mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-24 18:07:38 +00:00
make check more robust
This commit is contained in:
@@ -222,6 +222,18 @@ class OutputOptionsMixin:
|
||||
if getattr(cls, 'output_options', None) is not None:
|
||||
schema_for_view_output_options(cls)
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the mixin. Check that the serializer is compatible."""
|
||||
super().__init__()
|
||||
|
||||
# Check that the serializer was defined
|
||||
if hasattr(self, 'serializer_class') and (
|
||||
not issubclass(self.serializer_class, FilterableSerializerMixin)
|
||||
):
|
||||
raise Exception(
|
||||
'INVE-I2: `OutputOptionsMixin` can only be used with serializers that contain the `FilterableSerializerMixin` mixin'
|
||||
)
|
||||
|
||||
def get_serializer(self, *args, **kwargs):
|
||||
"""Return serializer instance with output options applied."""
|
||||
if self.output_options and hasattr(self, 'request'):
|
||||
|
||||
Reference in New Issue
Block a user