from rest_framework import serializers from core.apps.evaluation.models import MovablePropertyEvaluationModel class BaseMovablepropertyevaluationSerializer(serializers.ModelSerializer): property_category_display = serializers.CharField(source="get_property_category_display", read_only=True) condition_display = serializers.CharField(source="get_condition_display", read_only=True) class Meta: model = MovablePropertyEvaluationModel fields = [ "id", "valuation", "property_name", "property_category", "property_category_display", "serial_number", "manufacture_year", "condition", "condition_display", "quantity", ] class ListMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer): class Meta(BaseMovablepropertyevaluationSerializer.Meta): fields = [ "id", "valuation", "property_name", "property_category_display", "quantity", ] class RetrieveMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer): class Meta(BaseMovablepropertyevaluationSerializer.Meta): fields = BaseMovablepropertyevaluationSerializer.Meta.fields + [ "created_at", "updated_at", ] class CreateMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer): class Meta(BaseMovablepropertyevaluationSerializer.Meta): fields = [ "valuation", "property_name", "property_category", "serial_number", "manufacture_year", "condition", "quantity", ]