예제 #1
0
    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
예제 #2
0
 def get_point(self, obj):
     return get_serialized_data_handler(
         GeographicCoordinateSerializer,
         GeographicCoordinate,
         obj.point_id
     )
예제 #3
0
 def get_traffic(self, obj):
     return get_serialized_data_handler(
         TrafficInfoOnTravelRouteNodeSerializer,
         TrafficInfoOnTravelRouteNode,
         obj.traffic_info_id
     )
예제 #4
0
 def get_scene_point(self, obj):
     return get_serialized_data_handler(
         ScenePointOnTravelRouteNodeSerializer,
         ScenePointOnTravelRouteNode,
         obj.scene_point_id
     )
예제 #5
0
 def get_ticket_price(self, obj):
     return get_serialized_data_handler(
         AmountOfMoneySerializer,
         AmountOfMoney,
         obj.ticket_price_id
     )
예제 #6
0
 def get_end_point(self, obj):
     return get_serialized_data_handler(
         LocationPointSerializer,
         LocationPoint,
         obj.end_point_id
     )
예제 #7
0
 def get_fee(self, obj):
     return get_serialized_data_handler(
         AmountOfMoneySerializer,
         AmountOfMoney,
         obj.fee_id
     )