Esempio n. 1
0
    class TestSchema(ModelSchema):
        foreign_key_field = fields.RelatedNested(FKNestedSchema, required=False, allow_none=True)
        many_to_many_field = fields.RelatedNested(M2MNestedSchema, many=True)
        one_to_one_field = fields.RelatedNested(O2ONestedSchema)

        class Meta:
            model = db_models.AllRelatedFieldsModel
            fields = ('name', 'foreign_key_field', 'many_to_many_field', 'one_to_one_field')
    class TestSchema(ModelSchema):
        many_to_many_field = fields.RelatedNested(M2MSchema, many=True)

        class Meta:
            model = db_models.AllRelatedFieldsModel
            fields = ('name', 'many_to_many_field')
Esempio n. 3
0
    class TestSchema(ModelSchema):
        foreign_key_field = fields.RelatedNested(ForeignKeySchema)

        class Meta:
            model = db_models.AllRelatedFieldsModel
            fields = ('name', 'foreign_key_field')
Esempio n. 4
0
    class TestSchema(ModelSchema):
        one_to_one_field = fields.RelatedNested(O2ONestedSchema)

        class Meta:
            model = db_models.AllRelatedFieldsModel
            fields = ('name', 'foreign_key_field', 'many_to_many_field', 'one_to_one_field')