mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Read-only API
This commit is contained in:
@@ -8,11 +8,8 @@ class CabSerializer(serializers.ModelSerializer):
|
|||||||
manufacturer = ManufacturerSerializer()
|
manufacturer = ManufacturerSerializer()
|
||||||
decoder = DecoderSerializer()
|
decoder = DecoderSerializer()
|
||||||
company = CompanySerializer()
|
company = CompanySerializer()
|
||||||
# manufacturer = serializers.StringRelatedField()
|
|
||||||
# decoder = serializers.StringRelatedField()
|
|
||||||
# company = serializers.StringRelatedField()
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Cab
|
model = Cab
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
read_only_fields = ("identifier", "creation_time", "updated_time")
|
read_only_fields = ("creation_time", "updated_time")
|
||||||
|
@@ -1,27 +1,27 @@
|
|||||||
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateAPIView
|
from rest_framework.generics import ListAPIView, RetrieveAPIView
|
||||||
|
|
||||||
from roster.models import Cab
|
from roster.models import Cab
|
||||||
from roster.serializers import CabSerializer
|
from roster.serializers import CabSerializer
|
||||||
|
|
||||||
|
|
||||||
class RosterList(ListCreateAPIView):
|
class RosterList(ListAPIView):
|
||||||
queryset = Cab.objects.all()
|
queryset = Cab.objects.all()
|
||||||
serializer_class = CabSerializer
|
serializer_class = CabSerializer
|
||||||
|
|
||||||
|
|
||||||
class RosterGet(RetrieveUpdateAPIView):
|
class RosterGet(RetrieveAPIView):
|
||||||
queryset = Cab.objects.all()
|
queryset = Cab.objects.all()
|
||||||
serializer_class = CabSerializer
|
serializer_class = CabSerializer
|
||||||
lookup_field = 'uuid'
|
lookup_field = 'uuid'
|
||||||
|
|
||||||
|
|
||||||
class RosterAddress(RetrieveUpdateAPIView):
|
class RosterAddress(RetrieveAPIView):
|
||||||
queryset = Cab.objects.all()
|
queryset = Cab.objects.all()
|
||||||
serializer_class = CabSerializer
|
serializer_class = CabSerializer
|
||||||
lookup_field = 'address'
|
lookup_field = 'address'
|
||||||
|
|
||||||
|
|
||||||
class RosterIdentifier(RetrieveUpdateAPIView):
|
class RosterIdentifier(RetrieveAPIView):
|
||||||
queryset = Cab.objects.all()
|
queryset = Cab.objects.all()
|
||||||
serializer_class = CabSerializer
|
serializer_class = CabSerializer
|
||||||
lookup_field = 'identifier'
|
lookup_field = 'identifier'
|
||||||
|
Reference in New Issue
Block a user