2024-01-27 14:28:26 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
from sncfgtfs.models import Agency, Stop, Route, Trip, StopTime, Calendar, CalendarDate, \
|
|
|
|
Transfer, FeedInfo
|
|
|
|
|
|
|
|
|
|
|
|
class AgencySerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Agency
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class StopSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Stop
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class RouteSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Route
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class TripSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Trip
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class StopTimeSerializer(serializers.ModelSerializer):
|
2024-01-29 21:10:50 +00:00
|
|
|
arrival_date = serializers.DateField(required=False)
|
|
|
|
departure_date = serializers.DateField(required=False)
|
|
|
|
arrival_time_24h = serializers.DurationField(required=False)
|
|
|
|
departure_time_24h = serializers.DurationField(required=False)
|
|
|
|
|
2024-01-27 14:28:26 +00:00
|
|
|
class Meta:
|
|
|
|
model = StopTime
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class CalendarSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Calendar
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class CalendarDateSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = CalendarDate
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class TransferSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Transfer
|
|
|
|
fields = '__all__'
|
|
|
|
|
|
|
|
|
|
|
|
class FeedInfoSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = FeedInfo
|
|
|
|
fields = '__all__'
|