Skip to content

concept_serializers#

SpatialModelSerializer#

Bases: CommonModelSerializer

Model Serializer for Spatial

Source code in src/apps/core/serializers/concept_serializers.py
class SpatialModelSerializer(CommonModelSerializer):
    """Model Serializer for Spatial"""

    reference = concepts.Location.get_serializer_field(required=False, allow_null=True)
    custom_wkt = serializers.ListField(child=WKTField(), required=False, allow_null=True)

    class Meta:
        model = Spatial
        list_serializer_class = CommonListSerializer
        fields = [
            "full_address",
            "geographic_name",
            "altitude_in_meters",
            "reference",
            "custom_wkt",
        ]
        list_serializer_class = CommonListSerializer
        validators = [
            AnyOf(
                [
                    "full_address",
                    "geographic_name",
                    "altitude_in_meters",
                    "reference",
                    "custom_wkt",
                ]
            )
        ]