serializers.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:sahaf 作者: EmreYavuz216 项目源码 文件源码
def distance(self,obj):
        if 'location' in self.context.keys():
            request = self.context['request']
            tuple_x_y  = (float(request.query_params['Latitude']),float(request.query_params['Longitude']))
            point = Point(tuple_x_y,srid=4326)
            result = distance(obj.Point,point).km
            if result < 5:
                return '5 km içerisinde'
            elif result > 5 and result < 10:
                return '10 km içerisinde'
            elif result > 10 and result < 25:
                return '25 km içerisinde'
            elif result > 25 and result < 50:
                return '50 km içerisinde'
            else:
                return obj.City + ' çevresinde'
        return obj.City + ' çevresinde'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号