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.
51 lines
1.0 KiB
51 lines
1.0 KiB
from rest_framework.serializers import ModelSerializer
|
|
|
|
from projects.models import Project
|
|
from specializations.models import Specialization
|
|
from users.models import CustomUser
|
|
|
|
|
|
class CustomUserSerializer(ModelSerializer):
|
|
class Meta:
|
|
model = CustomUser
|
|
|
|
fields = (
|
|
'id',
|
|
'email',
|
|
'firstname',
|
|
'is_active',
|
|
'is_admin',
|
|
'lastname',
|
|
)
|
|
|
|
|
|
class SpecializationSerializer(ModelSerializer):
|
|
class Meta:
|
|
model = Specialization
|
|
|
|
fields = (
|
|
'id',
|
|
'level',
|
|
'lft',
|
|
'name',
|
|
'parent',
|
|
'rght',
|
|
'tree_id',
|
|
)
|
|
|
|
|
|
class ProjectSerializer(ModelSerializer):
|
|
class Meta:
|
|
model = Project
|
|
|
|
fields = (
|
|
'id',
|
|
'name',
|
|
'price',
|
|
'specialization',
|
|
'text',
|
|
'user',
|
|
)
|
|
|
|
user = CustomUserSerializer()
|
|
specialization = SpecializationSerializer()
|
|
|