summaryrefslogtreecommitdiff
path: root/procurement/serializers.py
diff options
context:
space:
mode:
Diffstat (limited to 'procurement/serializers.py')
-rw-r--r--procurement/serializers.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/procurement/serializers.py b/procurement/serializers.py
new file mode 100644
index 0000000..1840837
--- /dev/null
+++ b/procurement/serializers.py
@@ -0,0 +1,17 @@
+from rest_framework import serializers
+from procurement.models import Component, Supplier
+
+
+class SupplierSerializer(serializers.ModelSerializer):
+ class Meta:
+ model = Supplier
+ exclude = ('created', 'updated')
+
+
+class ComponentSerializer(serializers.ModelSerializer):
+ text = serializers.CharField(source='__str__', read_only=True)
+ suppliers = SupplierSerializer(many=True, read_only=True)
+
+ class Meta:
+ model = Component
+ exclude = ('created', 'updated')