summaryrefslogtreecommitdiffstats
path: root/storage/serializers.py
diff options
context:
space:
mode:
Diffstat (limited to 'storage/serializers.py')
-rw-r--r--storage/serializers.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/storage/serializers.py b/storage/serializers.py
index f7f58a8..f554c8f 100644
--- a/storage/serializers.py
+++ b/storage/serializers.py
@@ -1,4 +1,4 @@
-from storage.models import Item, Label
+from storage.models import Item, Label, LabelStyle
from rest_framework import serializers
from rest_framework_hstore.serializers import HStoreSerializer
@@ -8,9 +8,17 @@ class ItemSerializer(HStoreSerializer):
model = Item
fields = ('uuid', 'name', 'description', 'props', 'state', 'parent')
+
+class LabelStyleSerializer(serializers.ModelSerializer):
+ class Meta:
+ model = LabelStyle
+ fields = ('uuid', 'description', 'length', 'width')
+
+
class LabelSerializer(serializers.ModelSerializer):
item = ItemSerializer(required=False)
item_id = serializers.PrimaryKeyRelatedField(queryset=Item.objects, source='item')
+ style = LabelStyleSerializer(required=True)
class Meta:
model = Label
fields = ('id', 'item', 'item_id', 'style')