2022-07-19 18:53:06 +02:00
|
|
|
from django.conf import settings
|
|
|
|
from rest_framework.permissions import AllowAny
|
|
|
|
from rest_framework.response import Response
|
|
|
|
from rest_framework.views import APIView
|
|
|
|
|
2022-08-24 10:38:53 +02:00
|
|
|
from ..models import Preference
|
|
|
|
from ..serializers import InfoSerializer, VersionSerializer
|
2022-07-19 18:53:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
class VersionView(APIView):
|
|
|
|
permission_classes = [AllowAny]
|
|
|
|
serializer_class = VersionSerializer
|
|
|
|
|
|
|
|
def get(self, request):
|
|
|
|
return Response({"api_version": settings.API_VERSION})
|
2022-08-24 10:38:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
class InfoView(APIView):
|
|
|
|
permission_classes = [AllowAny]
|
|
|
|
serializer_class = InfoSerializer
|
|
|
|
|
|
|
|
def get(self, request):
|
|
|
|
data = Preference.get_site_preferences()
|
|
|
|
return Response(
|
2023-12-27 15:46:38 +01:00
|
|
|
data.model_dump(
|
2022-08-24 10:38:53 +02:00
|
|
|
include={
|
|
|
|
"station_name",
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|