You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.0 KiB
87 lines
2.0 KiB
from rest_framework.serializers import ModelSerializer
|
|
|
|
from .models import Project, Realty, BuildingClassfication, ConstructionType, Order
|
|
from common.serializers import LocationSerializer
|
|
from specializations.serializers import SpecializationSerializer
|
|
from users.serializers import UserSerializer
|
|
|
|
|
|
class BuildingClassficationSerializer(ModelSerializer):
|
|
class Meta:
|
|
model = BuildingClassfication
|
|
|
|
fields = (
|
|
'id',
|
|
'name',
|
|
)
|
|
|
|
|
|
class ConstructionTypeSerializer(ModelSerializer):
|
|
class Meta:
|
|
model = ConstructionType
|
|
|
|
fields = (
|
|
'id',
|
|
'name',
|
|
)
|
|
|
|
|
|
class RealtySerializer(ModelSerializer):
|
|
building_classification = BuildingClassficationSerializer()
|
|
construction_type = ConstructionTypeSerializer()
|
|
location = LocationSerializer()
|
|
user = UserSerializer()
|
|
|
|
class Meta:
|
|
model = Realty
|
|
|
|
fields = (
|
|
'building_classification',
|
|
'construction_type',
|
|
'id',
|
|
'location',
|
|
'name',
|
|
'user',
|
|
)
|
|
|
|
|
|
class OrderSerializer(ModelSerializer):
|
|
class Meta:
|
|
model = Order
|
|
|
|
fields = (
|
|
'contractor',
|
|
'created',
|
|
'project',
|
|
'secure',
|
|
'status',
|
|
)
|
|
|
|
|
|
class ProjectSerializer(ModelSerializer):
|
|
customer = UserSerializer()
|
|
specialization = SpecializationSerializer()
|
|
realty = RealtySerializer()
|
|
|
|
class Meta:
|
|
model = Project
|
|
|
|
fields = (
|
|
'budget',
|
|
'budget_by_agreement',
|
|
'created',
|
|
'cro',
|
|
'currency',
|
|
'customer',
|
|
'deal_type',
|
|
'id',
|
|
'name',
|
|
'price_and_term_required',
|
|
'realty',
|
|
'specialization',
|
|
'state',
|
|
'term',
|
|
'term_type',
|
|
'text',
|
|
'work_type',
|
|
)
|
|
|