2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-10-25 02:17:37 +00:00

simplify more

This commit is contained in:
Matthias Mair
2025-10-15 00:12:06 +02:00
parent 6549ad63b1
commit 4ef24cae4a
3 changed files with 4 additions and 12 deletions

View File

@@ -381,8 +381,8 @@ class DependentField(serializers.Field):
return None return None
class BareInvenTreeModelSerializer(serializers.ModelSerializer): class InvenTreeModelSerializer(FilterableSerializerField, serializers.ModelSerializer):
"""Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation. Without Filtering support.""" """Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation."""
# Switch out URLField mapping # Switch out URLField mapping
serializer_field_mapping = { serializer_field_mapping = {
@@ -547,13 +547,6 @@ class BareInvenTreeModelSerializer(serializers.ModelSerializer):
return data return data
class InvenTreeModelSerializer(FilterableSerializerField, BareInvenTreeModelSerializer):
"""Inherits the standard Django ModelSerializer class, but also ensures that the underlying model class data are checked on validation.
This field allows filtering.
"""
class InvenTreeTaggitSerializer(TaggitSerializer): class InvenTreeTaggitSerializer(TaggitSerializer):
"""Updated from https://github.com/glemmaPaul/django-taggit-serializer.""" """Updated from https://github.com/glemmaPaul/django-taggit-serializer."""

View File

@@ -22,7 +22,6 @@ from InvenTree.helpers import get_objectreference
from InvenTree.helpers_model import construct_absolute_url from InvenTree.helpers_model import construct_absolute_url
from InvenTree.mixins import DataImportExportSerializerMixin from InvenTree.mixins import DataImportExportSerializerMixin
from InvenTree.serializers import ( from InvenTree.serializers import (
BareInvenTreeModelSerializer,
InvenTreeAttachmentSerializerField, InvenTreeAttachmentSerializerField,
InvenTreeImageSerializerField, InvenTreeImageSerializerField,
InvenTreeModelSerializer, InvenTreeModelSerializer,
@@ -72,7 +71,7 @@ class SettingsValueField(serializers.Field):
return str(data) return str(data)
class SettingsSerializer(BareInvenTreeModelSerializer): class SettingsSerializer(InvenTreeModelSerializer):
"""Base serializer for a settings object.""" """Base serializer for a settings object."""
key = serializers.CharField(read_only=True) key = serializers.CharField(read_only=True)

View File

@@ -632,7 +632,7 @@ class PartSerializer(
InvenTree.serializers.NotesFieldMixin, InvenTree.serializers.NotesFieldMixin,
InvenTree.serializers.RemoteImageMixin, InvenTree.serializers.RemoteImageMixin,
InvenTree.serializers.InvenTreeTaggitSerializer, InvenTree.serializers.InvenTreeTaggitSerializer,
InvenTree.serializers.BareInvenTreeModelSerializer, InvenTree.serializers.InvenTreeModelSerializer,
): ):
"""Serializer for complete detail information of a part. """Serializer for complete detail information of a part.