Add documentation and source

Added documentation, source and extra files.
This commit is contained in:
2025-07-02 20:26:50 +02:00
parent 4fc1d36a10
commit e3ebf6bf4f
295 changed files with 24986 additions and 0 deletions

View File

@ -0,0 +1,21 @@
from django.core.files.storage import DefaultStorage
from django.http import HttpRequest, HttpResponse
def view_file_download(request: HttpRequest) -> HttpResponse:
"""
Serve a media file like a download.
Args:
request: HTTP request.
Returns:
Media file as an attachment to download.
"""
storage = DefaultStorage() # Objet capable de manipuler des fichiers média
with storage.open("django-upload.jpg", "rb") as file: # relative to MEDIA_ROOT
response = HttpResponse(file, content_type="image/jpeg")
# Use list notation to set headers
response["Content-Disposition"] = "attachment; filename=django-upload.jpg"
return response