Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ojford/marshmallow-dataclass-djangofield

Use a marshmallow dataclass as a Django Field
https://github.com/ojford/marshmallow-dataclass-djangofield

dataclass django field marshmallow orm

Last synced: about 1 month ago
JSON representation

Use a marshmallow dataclass as a Django Field

Awesome Lists containing this project

README

        

Use [marshmallow-dataclass](https://github.com/lovasoa/marshmallow_dataclass)es as [Django](https://github.com/django/django) Fields.

## Usage
```python
from marshmallow_dataclass_djangofield import MarshmallowField
from marshmallow_dataclass_djangofield import marshmallow_dataclass_djangofield

class MyModel(Model):

@marshmallow_dataclass_djangofield(model_name='MyModel')
@marshmallow_dataclass.dataclass
class MyDataClass:
foo: str
bar: int

foobars = MarshmallowField(many=True, schema=MyDataClass)
```