class TestValidation(BaseSerializer):

            choices = fields.StringField(choices=["1", "2", "3"],
                                         required=True)
            not_req = fields.StringField()
            boolean = fields.BooleanField(required=True)
            boolean_not_req = fields.BooleanField()
            string_def = fields.StringField(default="", required=True)
            dt = fields.DateTimeField()
        class S(BaseSerializer):

            field = fields.StringField(required=True)
        class SimpleSerializer(BaseSerializer):

            value = fields.StringField(
                validators=[UniqueValidator(qs=UniqueCol.objects.all())])
        class S(BaseSerializer):

            value = fields.StringField()
            created = fields.DateTimeField(read_only=True)
        class TestSerializer(BaseSerializer):

            field = fields.StringField(required=True)

            class Meta:
                allow_additional_fields = True
Exemple #6
0
 class Nested(BaseSerializer):
     value = fields.StringField()