===============
DRF File Upload
A reusable django library to handle file upload with the Django Rest Framework.
It provides views, serializers and models for simplifying file uploads and their model association in your RESTful application.
How it works
Quick start
-
Add "drf_file_upload" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'drf_file_upload',
]
-
Include the polls URLconf in your project urls.py like this::
path('upload/', include('drf_file_upload.urls')),
This will add both separate authenticated and anonymous users to file upload endpoints.
Todo: add single view examples
-
Add the UploadedFileField to your serializers todo
-
Run python manage.py migrate
to create the file upload models.
-
Run the cleanup management command deleted_expired_uploaded_files
in a cron task or add a celery task
TODO: Improve https://docs.djangoproject.com/en/3.1/intro/reusable-apps/
=============
TODOs & IDEAS
- Add support for Image file
- check if DRF dedicated fields can be exploited
- lots of config (e.g.
permission_classes
)
- check if
clean_uploaded_files
can be called somewhere else to avoid save
method override
- Documentation!
- Check if the file field can be set globally for all model FileFields
- Add better spectacle openapi docs
- Add missing tests