Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pcouy/drf-nested-browsable
Writable nested serializers with forms for DRF Browsable API
https://github.com/pcouy/drf-nested-browsable
django django-rest-framework drf-browsable-api drf-serializer drf-writable-nested
Last synced: about 4 hours ago
JSON representation
Writable nested serializers with forms for DRF Browsable API
- Host: GitHub
- URL: https://github.com/pcouy/drf-nested-browsable
- Owner: pcouy
- Created: 2023-04-23T11:14:30.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-30T19:27:23.000Z (7 months ago)
- Last Synced: 2024-08-08T22:34:20.180Z (3 months ago)
- Topics: django, django-rest-framework, drf-browsable-api, drf-serializer, drf-writable-nested
- Language: Python
- Homepage: https://pierre-couy.dev/projects/drf-nested-browsable.html
- Size: 42 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
:warning: Work In Progress :warning:
# Writable Nested Serializers with Browsable API Forms
This plugin is intended to provide writable nested serializers (similar to [the recommended plugin from DRF documentation](https://github.com/beda-software/drf-nested-browsable.git)) that bring their own forms for the Browsable API renderer.
## Try it out
This project's dependencies are managed using [`poetry`](https://python-poetry.org/)
```bash
git clone https://github.com/pcouy/drf-nested-browsable
cd drf-nested-browsable
poetry install
cd example
poetry shell
python manage.py migrate
python manage.py runserver
```The above commands will install the dependencies, run the DB migrations, and launch a development server of the example project that uses the provided serializers.
## Current state of the project
### Done
* Ability to write to a reverse `ForeignKey` relationship using serializer `Meta` class
* Dynamic form for `WritableNestedListSerializer` that allows adding and removing children from the Browsable API
* Arbitrary nesting depth
* Dynamically removing the parent field from serializers when used as an inner serializer
* Basic example
* Support `RecursiveField` from
[`djangorestframework-recursive`](https://github.com/heywbj/django-rest-framework-recursive)### To do
* Write documentation / Auto-generate it from the docstrings ([pdoc](https://pdoc.dev/) ?)
* Write tests/specs (from example ?)
* Better form design
* Add `ManyToMany` to example (and test it)
* Consider database schema constrains :
* Look into what `drf-writable-nested` does with uniqueness
* When the foreign key can be `null`, show a multiple select field for attaching orphan instances to a parent instance
* Show a multiple select field for `ManyToMany` relationships