示例#1
0
class EmployeeSerializer(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    company_name = Field(dump_only=True)
    address = NestedModelField(Address)
    contacts = NestedModelListField(Contact)
示例#2
0
class EmployeeSerializerMixedFields(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    address = NestedAttributesField({
        'id': int,
        'street': str,
        'number': str,
        'city': str
    })
    company = NestedModelField(Company)
    department = PrimaryKeyField(Department)
示例#3
0
class EmployeeSerializerNestedModelFields(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    address = NestedModelField(Address)
    company = NestedModelField(Company)
示例#4
0
class AcordoLenienciaSerializer(ModelSerializer):

    empresa = NestedModelField(Empresa)