... | ... | @@ -565,7 +565,7 @@ print(json.dumps(seria.data), indent=2) |
|
|
|
|
|
[Official DRF documentaiton on serializer relations](https://www.django-rest-framework.org/api-guide/relations/)
|
|
|
|
|
|
A nice addition to avoid code duplication is the possibility to use an already written serializer as a serializer field on a relation between Django models, which means that the value of the field will be the full-blown JSON object itself. For a better exaplnation, consider the following example
|
|
|
A nice addition to avoid code duplication is the possibility to use an already written serializer as a serializer field on a relation between Django models, which means that the value of the field will be the full-blown JSON object itself. For a better explanation, consider the following example
|
|
|
|
|
|
```python
|
|
|
import json
|
... | ... | |