hamma modellarda get serizlizers uchun fiedl qoshilfi
This commit is contained in:
@@ -1,28 +1,50 @@
|
||||
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",
|
||||
# "name",
|
||||
"valuation",
|
||||
"property_name",
|
||||
"property_category",
|
||||
"property_category_display",
|
||||
"serial_number",
|
||||
"manufacture_year",
|
||||
"condition",
|
||||
"condition_display",
|
||||
"quantity",
|
||||
]
|
||||
|
||||
|
||||
class ListMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta): ...
|
||||
|
||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta):
|
||||
fields = [
|
||||
"id",
|
||||
"valuation",
|
||||
"property_name",
|
||||
"property_category_display",
|
||||
"quantity",
|
||||
]
|
||||
|
||||
class RetrieveMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta): ...
|
||||
|
||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta):
|
||||
fields = BaseMovablepropertyevaluationSerializer.Meta.fields + [
|
||||
"created_at",
|
||||
"updated_at",
|
||||
]
|
||||
|
||||
class CreateMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta):
|
||||
fields = [
|
||||
"id",
|
||||
# "name",
|
||||
"valuation",
|
||||
"property_name",
|
||||
"property_category",
|
||||
"serial_number",
|
||||
"manufacture_year",
|
||||
"condition",
|
||||
"quantity",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user