From 2f7030d96472223d9680dda9ff0e2e74338f6cdf Mon Sep 17 00:00:00 2001 From: klmp200 Date: Fri, 19 Aug 2016 17:25:23 +0200 Subject: [PATCH] Fixed api's list bug --- api/views/counter.py | 6 ++++-- api/views/launderette.py | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/api/views/counter.py b/api/views/counter.py index 6c34029a..69a98660 100644 --- a/api/views/counter.py +++ b/api/views/counter.py @@ -11,12 +11,14 @@ class CounterSerializer(serializers.ModelSerializer): is_open = serializers.BooleanField(read_only=True) barman_list = serializers.ListField( - child=serializers.IntegerField() + child=serializers.IntegerField(), + read_only=True ) class Meta: model = Counter - fields = ('id', 'name', 'type', 'is_open', 'barman_list') + fields = ('id', 'name', 'type', 'club', + 'products', 'is_open', 'barman_list') class CounterViewSet(RightModelViewSet): diff --git a/api/views/launderette.py b/api/views/launderette.py index a2423c17..c3e586c0 100644 --- a/api/views/launderette.py +++ b/api/views/launderette.py @@ -9,10 +9,12 @@ from api.views import RightModelViewSet class LaunderettePlaceSerializer(serializers.ModelSerializer): machine_list = serializers.ListField( - child=serializers.IntegerField() + child=serializers.IntegerField(), + read_only=True ) token_list = serializers.ListField( - child=serializers.IntegerField() + child=serializers.IntegerField(), + read_only=True ) class Meta: @@ -24,7 +26,7 @@ class LaunderetteMachineSerializer(serializers.ModelSerializer): class Meta: model = Machine - fields = ('id', 'name', 'is_working', 'launderette') + fields = ('id', 'name', 'type', 'is_working', 'launderette') class LaunderetteTokenSerializer(serializers.ModelSerializer):