| 1 |
from django.core.files.storage import FileSystemStorage |
| 2 |
|
| 3 |
from django_downloadview import StorageDownloadView |
| 4 |
|
| 5 |
storage = FileSystemStorage() |
| 6 |
|
| 7 |
|
| 8 |
#: Serve file using ``path`` argument. |
| 9 |
static_path = StorageDownloadView.as_view(storage=storage) |
| 10 |
|
| 11 |
|
| 12 |
class DynamicStorageDownloadView(StorageDownloadView): |
| 13 |
"""Serve file of storage by path.upper().""" |
| 14 |
|
| 15 |
def get_path(self): |
| 16 |
"""Return uppercase path.""" |
| 17 |
return super().get_path().upper() |
| 18 |
|
| 19 |
|
| 20 |
dynamic_path = DynamicStorageDownloadView.as_view(storage=storage) |