def get_content(self, obj): """ 序列化 TravelRouteNode """ route_node_ids = obj.get_route_node_ids() node_data = [] for node_id in route_node_ids: try: data = get_serialized_data_handler( TravelRouteNodeSerializer, TravelRouteNode, node_id ) node_data.append(data) # 忽略错误的节点 except: pass return node_data
def get_point(self, obj): return get_serialized_data_handler( GeographicCoordinateSerializer, GeographicCoordinate, obj.point_id )
def get_traffic(self, obj): return get_serialized_data_handler( TrafficInfoOnTravelRouteNodeSerializer, TrafficInfoOnTravelRouteNode, obj.traffic_info_id )
def get_scene_point(self, obj): return get_serialized_data_handler( ScenePointOnTravelRouteNodeSerializer, ScenePointOnTravelRouteNode, obj.scene_point_id )
def get_ticket_price(self, obj): return get_serialized_data_handler( AmountOfMoneySerializer, AmountOfMoney, obj.ticket_price_id )
def get_end_point(self, obj): return get_serialized_data_handler( LocationPointSerializer, LocationPoint, obj.end_point_id )
def get_fee(self, obj): return get_serialized_data_handler( AmountOfMoneySerializer, AmountOfMoney, obj.fee_id )