Example #1
0
    def __init__(self, field: fields.Field):
        """Create a converter for data of the field type

        Args:
            field (Field): Marshmallow Field type of data
        """
        Schema.__init__(self)
        self.field = field
    def __init__(self, *args, **kwargs):
        schema_kwargs = {'many': kwargs.get('many', False)}
        # Remove any kwargs that are only valid for marshmallow schemas
        for key in _schema_kwargs:
            if key in kwargs:
                schema_kwargs[key] = kwargs.pop(key)

        super(Schema, self).__init__(*args, **kwargs)
        MarshmallowSchema.__init__(self, **schema_kwargs)
    def __init__(self, *args, **kwargs):
        schema_kwargs = {"many": kwargs.get("many", False)}
        # Remove any kwargs that are only valid for marshmallow schemas
        for key in _schema_kwargs:
            if key in kwargs:
                schema_kwargs[key] = kwargs.pop(key)

        super(Schema, self).__init__(*args, **kwargs)
        MarshmallowSchema.__init__(self, **schema_kwargs)
    def __init__(self, *args, **kwargs):
        schema_kwargs = {
            'many': kwargs.get('many', False)
        }
        # Remove any kwargs that are only valid for marshmallow schemas
        for key in _schema_kwargs:
            if key in kwargs:
                schema_kwargs[key] = kwargs.pop(key)

        super(Schema, self).__init__(*args, **kwargs)
        # XXX: Remove parent attribute so that Field.root resolves properly
        #  https://github.com/marshmallow-code/django-rest-marshmallow/issues/131#issuecomment-601089549
        delattr(self, 'parent')
        MarshmallowSchema.__init__(self, **schema_kwargs)
Example #5
0
 def __init__(self, valid_color_keys):
     Schema.__init__(self)
     self._valid_color_keys = valid_color_keys