Python 验证中的geo_字段被读取为str

Python 验证中的geo_字段被读取为str,python,django,django-rest-framework,gis,django-rest-framework-gis,Python,Django,Django Rest Framework,Gis,Django Rest Framework Gis,我正在尝试将一个项目从django rest framework gis 0.7迁移到0.8,并从django rest framework 2.4.3迁移。到3.0.5。我解决了很多错误,但我已经停止了以下问题 My GeoFeatureModelSerializer具有以下属性: class Meta: model = RoadRoute id_field = False geo_field = 'geom' fields = ('auth_code'

我正在尝试将一个项目从django rest framework gis 0.7迁移到0.8,并从django rest framework 2.4.3迁移。到3.0.5。我解决了很多错误,但我已经停止了以下问题

My GeoFeatureModelSerializer具有以下属性:

class Meta:
     model = RoadRoute
     id_field = False
     geo_field = 'geom'
     fields = ('auth_code', 'states', 'creation_date')


def validate(self, attrs):
     if len(attrs['states']) > 0:
          states = State.objects.filter(code__in=attrs['states']).unionagg()
          if attrs['geom'].within(states) is False:
               raise ValidationError(_('Route is not within the allowed states.'))
          else:
               return attrs
     else:
          raise ValidationError(_('States field can not be empty.'))
在我的测试中,我有一个错误:

File "/home/wille/py-projects/routes_registry_api/routes_registry_api/routes/serializers.py", line 59, in validate
    if attrs['geom'].within(states) is False:
AttributeError: 'str' object has no attribute 'within'
geom字段不是作为GeometryField读取的,而是作为str读取的。在0.7版本的DRF gis中,相同的代码工作正常