add new app
This commit is contained in:
0
core/apps/wherehouse/serializers/__init__.py
Normal file
0
core/apps/wherehouse/serializers/__init__.py
Normal file
11
core/apps/wherehouse/serializers/inventory.py
Normal file
11
core/apps/wherehouse/serializers/inventory.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
from core.apps.wherehouse.models.inventory import Inventory
|
||||
|
||||
|
||||
class WhereHouseInventoryListSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Inventory
|
||||
fields = [
|
||||
'id', 'quantity', 'product'
|
||||
]
|
||||
27
core/apps/wherehouse/serializers/wherehouse.py
Normal file
27
core/apps/wherehouse/serializers/wherehouse.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
from core.apps.wherehouse.models.wherehouse import WhereHouse
|
||||
from core.apps.wherehouse.serializers.inventory import WhereHouseInventoryListSerializer
|
||||
from core.apps.company.serializers.branch import BranchListSerializer
|
||||
|
||||
|
||||
class WhereHouseListSerializer(serializers.ModelSerializer):
|
||||
branch = BranchListSerializer()
|
||||
|
||||
class Meta:
|
||||
model = WhereHouse
|
||||
fields = [
|
||||
'id', 'name', 'address', 'branch'
|
||||
]
|
||||
|
||||
|
||||
class WhereHouseDetailSerializer(serializers.ModelSerializer):
|
||||
branch = BranchListSerializer()
|
||||
inventories = WhereHouseInventoryListSerializer(many=True)
|
||||
|
||||
class Meta:
|
||||
model = WhereHouse
|
||||
fields = [
|
||||
'id', 'name', 'address', 'branch', 'inventories'
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user