99 lines
3.7 KiB
Python
99 lines
3.7 KiB
Python
from django.contrib import admin
|
|
|
|
from sncfgtfs.models import Agency, Stop, Route, Trip, StopTime, Calendar, CalendarDate, \
|
|
Transfer, FeedInfo, StopTimeUpdate, TripUpdate
|
|
|
|
|
|
@admin.register(Agency)
|
|
class AgencyAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'id', 'url', 'timezone',)
|
|
search_fields = ('name',)
|
|
|
|
|
|
@admin.register(Stop)
|
|
class StopAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'id', 'lat', 'lon', 'location_type',)
|
|
list_filter = ('location_type',)
|
|
search_fields = ('name', 'id',)
|
|
ordering = ('name',)
|
|
autocomplete_fields = ('parent_station',)
|
|
|
|
|
|
@admin.register(Route)
|
|
class RouteAdmin(admin.ModelAdmin):
|
|
list_display = ('long_name', 'short_name', 'id', 'type',)
|
|
list_filter = ('type',)
|
|
search_fields = ('long_name', 'short_name', 'id',)
|
|
ordering = ('long_name',)
|
|
autocomplete_fields = ('agency',)
|
|
|
|
|
|
@admin.register(Trip)
|
|
class TripAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'route', 'service', 'headsign', 'direction_id',)
|
|
list_filter = ('direction_id', 'service__transport_type',)
|
|
search_fields = ('id', 'route__id', 'route__long_name', 'service__id', 'headsign',)
|
|
ordering = ('route', 'service',)
|
|
|
|
|
|
@admin.register(StopTime)
|
|
class StopTimeAdmin(admin.ModelAdmin):
|
|
list_display = ('trip', 'stop', 'arrival_time', 'departure_time',
|
|
'stop_sequence', 'pickup_type', 'drop_off_type',)
|
|
list_filter = ('pickup_type', 'drop_off_type', 'trip__service__transport_type',)
|
|
search_fields = ('trip__id', 'stop__name', 'arrival_time', 'departure_time',)
|
|
ordering = ('trip', 'stop_sequence',)
|
|
autocomplete_fields = ('trip', 'stop',)
|
|
|
|
|
|
@admin.register(Calendar)
|
|
class CalendarAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'transport_type', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday',
|
|
'saturday', 'sunday', 'start_date', 'end_date',)
|
|
list_filter = ('transport_type', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday',
|
|
'start_date', 'end_date',)
|
|
search_fields = ('id', 'start_date', 'end_date',)
|
|
ordering = ('transport_type', 'id',)
|
|
|
|
|
|
@admin.register(CalendarDate)
|
|
class CalendarDateAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'service_id', 'date', 'exception_type',)
|
|
list_filter = ('exception_type', 'date', 'service__transport_type',)
|
|
search_fields = ('id', 'date',)
|
|
ordering = ('date', 'service_id',)
|
|
|
|
|
|
@admin.register(Transfer)
|
|
class TransferAdmin(admin.ModelAdmin):
|
|
list_display = ('from_stop', 'to_stop', 'transfer_type', 'min_transfer_time',)
|
|
list_filter = ('transfer_type',)
|
|
search_fields = ('from_stop__name', 'to_stop__name',)
|
|
autocomplete_fields = ('from_stop', 'to_stop',)
|
|
|
|
|
|
@admin.register(FeedInfo)
|
|
class FeedInfoAdmin(admin.ModelAdmin):
|
|
list_display = ('publisher_name', 'publisher_url', 'lang', 'start_date',
|
|
'end_date', 'version',)
|
|
search_fields = ('publisher_name', 'publisher_url', 'lang', 'start_date',
|
|
'end_date', 'version',)
|
|
ordering = ('publisher_name',)
|
|
|
|
|
|
@admin.register(StopTimeUpdate)
|
|
class StopTimeUpdateAdmin(admin.ModelAdmin):
|
|
list_display = ('trip_update', 'stop_time', 'arrival_delay', 'arrival_time',
|
|
'departure_delay', 'departure_time', 'schedule_relationship',)
|
|
list_filter = ('schedule_relationship',)
|
|
search_fields = ('trip_update__trip_id', 'stop_time__stop__name', 'arrival_time', 'departure_time',)
|
|
ordering = ('trip_update', 'stop_time',)
|
|
|
|
|
|
@admin.register(TripUpdate)
|
|
class TripUpdateAdmin(admin.ModelAdmin):
|
|
list_display = ('trip_id', 'start_date', 'start_time',)
|
|
search_fields = ('trip_id', 'start_date', 'start_time',)
|
|
ordering = ('trip_id', 'start_date', 'start_time',)
|
|
autocomplete_fields = ('trip',)
|