trainvel/sncf/api/serializers.py

77 lines
1.8 KiB
Python
Raw Normal View History

2024-01-27 14:28:26 +00:00
from rest_framework import serializers
from sncfgtfs.models import Agency, Stop, Route, Trip, StopTime, Calendar, CalendarDate, \
2024-02-04 22:58:27 +00:00
Transfer, FeedInfo, TripUpdate, StopTimeUpdate
2024-01-27 14:28:26 +00:00
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)
2024-02-10 21:18:04 +00:00
departure_time_real = serializers.CharField(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__'
2024-02-04 22:58:27 +00:00
class TripUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = TripUpdate
fields = '__all__'
class StopTimeUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = StopTimeUpdate
fields = '__all__'