예제 #1
0
class EmployeeSerializerPrimaryKeyFields(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    address = PrimaryKeyField(Address)
    company = PrimaryKeyField(Company)
    department = PrimaryKeyField(Department)
예제 #2
0
class EmployeeSerializerNestedAttrsFields(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    address = NestedAttributesField(('id', 'street', 'number', 'city'))
    company = NestedAttributesField(('name', 'location'))
    department = NestedAttributesField(('name', ))
예제 #3
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)
예제 #4
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)
예제 #5
0
class EmployeeSerializerCreationOnlyField(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    email = Field(creation_only=True)
예제 #6
0
class EmployeeInheritedModelSerializer(PolymorphicModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
예제 #7
0
class EmployeeSerializerProtectedField(ModelSerializer):

    _role = Field()
예제 #8
0
class EmployeeSerializerHybridProperty(ModelSerializer):

    full_name = Field(dump_only=True)
예제 #9
0
class EmployeeSerializerNestedModelFields(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    address = NestedModelField(Address)
    company = NestedModelField(Company)
예제 #10
0
class EmployeeSerializerNestedAttrsFields(ModelSerializer):

    password = Field(load_only=True)
    created_at = Field(dump_only=True)
    address = NestedAttributesField(("id", "street", "number", "city"))
    company = NestedAttributesField(("name", "location"))