Make item field non-required on LabelSerializer

This commit is contained in:
Piotr Dobrowolski 2017-10-02 21:20:02 +02:00
parent 427da3e35c
commit 67a2446123
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ class ItemSerializer(HStoreSerializer):
fields = ('uuid', 'name', 'description', 'props', 'state', 'parent') fields = ('uuid', 'name', 'description', 'props', 'state', 'parent')
class LabelSerializer(serializers.ModelSerializer): class LabelSerializer(serializers.ModelSerializer):
item = ItemSerializer() item = ItemSerializer(required=False)
item_id = serializers.PrimaryKeyRelatedField(queryset=Item.objects, source='item') item_id = serializers.PrimaryKeyRelatedField(queryset=Item.objects, source='item')
class Meta: class Meta:
model = Label model = Label