From 12d1f9fd979c11b9e3a3a89b1595b07569b88f79 Mon Sep 17 00:00:00 2001 From: workmai Date: Thu, 4 Oct 2018 12:14:39 -0600 Subject: Initial commit of the coding assignment base project --- procurement/serializers.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 procurement/serializers.py (limited to 'procurement/serializers.py') 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') -- cgit v1.1