Пример #1
0
class JourneysSerializer(JourneysCommon):
    journeys = JourneySerializer(many=True)
    tickets = TicketSerializer(many=True, display_none=True)
    disruptions = pt.DisruptionSerializer(attr='impacts', many=True, display_none=True)
    terminus = pt.StopAreaSerializer(many=True, display_none=True)
    context = MethodField(schema_type=ContextSerializer(), display_none=False)
    notes = DescribedField(schema_type=NoteSerializer(many=True))
    exceptions = DescribedField(schema_type=ExceptionSerializer(many=True))

    def get_context(self, obj):
        return ContextSerializer(obj, display_none=False).data
Пример #2
0
class TrafficReportSerializer(PbNestedSerializer):
    network = pt.NetworkSerializer()
    lines = pt.LineSerializer(many=True)
    stop_areas = pt.StopAreaSerializer(many=True)
    vehicle_journeys = pt.VehicleJourneySerializer(many=True)
Пример #3
0
class StopAreasSerializer(PTReferentialSerializer):
    stop_areas = pt.StopAreaSerializer(many=True)