32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
from container.models import Container, ContainerType
|
|
from asset.models import Asset, GtinProduct
|
|
from rest_framework import serializers
|
|
|
|
|
|
class ContainerSerializer(serializers.HyperlinkedModelSerializer):
|
|
class Meta:
|
|
model = Container
|
|
fields = ['url', 'id', 'named_id', 'container_type', 'color', 'description']
|
|
|
|
|
|
class ContainerTypeSerializer(serializers.HyperlinkedModelSerializer):
|
|
class Meta:
|
|
model = ContainerType
|
|
fields = ['url', 'id',
|
|
'named_id', 'description', 'width', 'height', 'length',
|
|
'inner_width', 'inner_height', 'inner_length',
|
|
'has_cover', 'contains_container']
|
|
|
|
|
|
class AssetSerializer(serializers.HyperlinkedModelSerializer):
|
|
class Meta:
|
|
model = Asset
|
|
fields = ['url', 'id', 'named_id', 'description', 'quantity', 'description']
|
|
|
|
|
|
class GtinProductSerializer(serializers.HyperlinkedModelSerializer):
|
|
class Meta:
|
|
model = GtinProduct
|
|
fields = ['url', 'id', 'gtin', 'api_request', 'api_response', 'name', 'brand']
|
|
|