add new fields to rancher
This commit is contained in:
@@ -1,10 +1,27 @@
|
||||
from rest_framework import serializers
|
||||
from apps.product import models as product_models
|
||||
from apps.pos_device.models import POSFreeProducts
|
||||
from apps.authorization.api.v1 import serializers as authorize_serializers
|
||||
from apps.authentication.api.v1.serializers.serializer import OrganizationSerializer, OrganizationTypeSerializer
|
||||
|
||||
|
||||
class ProductCategorySerializer(serializers.ModelSerializer):
|
||||
class POSFreeProductSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = POSFreeProducts
|
||||
fields = '__all__'
|
||||
|
||||
def to_representation(self, instance):
|
||||
representation = super().to_representation(instance)
|
||||
|
||||
representation['product'] = {
|
||||
'name': instance.product.name,
|
||||
'id': instance.product.id
|
||||
}
|
||||
|
||||
return representation
|
||||
|
||||
|
||||
class ProductCategorySerializer(serializers.ModelSerializer): # noqa
|
||||
class Meta:
|
||||
model = product_models.ProductCategory
|
||||
fields = '__all__'
|
||||
|
||||
Reference in New Issue
Block a user