77 lines
1.8 KiB
Python
77 lines
1.8 KiB
Python
from rest_framework import serializers
|
|
|
|
from sncfgtfs.models import Agency, Stop, Route, Trip, StopTime, Calendar, CalendarDate, \
|
|
Transfer, FeedInfo, TripUpdate, StopTimeUpdate
|
|
|
|
|
|
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):
|
|
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)
|
|
departure_time_real = serializers.CharField(required=False)
|
|
|
|
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__'
|
|
|
|
|
|
class TripUpdateSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = TripUpdate
|
|
fields = '__all__'
|
|
|
|
|
|
class StopTimeUpdateSerializer(serializers.ModelSerializer):
|
|
class Meta:
|
|
model = StopTimeUpdate
|
|
fields = '__all__'
|