Skip to content

AttributeError: object has no attribute 'extent' #247

@hemache

Description

@hemache

Hello,

GeoFeatureModelSerializer fails to get bounding box when geo_field points to a SerializerMethodField

AttributeError: object has no attribute 'extent'

Example:

class PlaceSerializer(GeoFeatureModelSerializer):
    location = GeometrySerializerMethodField()

    class Meta:
        model = Location
        fields = ["name"]
        id_field = "pk"
        geo_field = "location"
        auto_bbox = True

    def get_location(self, obj):
        return obj.location.transform(4326, clone=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions