2
2
3
3
Django Chunk File Upload is an alternative utility that helps you easily edit Django's chunked, drag and drop file uploads.
4
4
5
- <img src =" https://i.ibb.co/9y2SgmS/f-P5-Or-Gkxk0-Ynj00ct-G.webp " alt =" f-P5-Or-Gkxk0-Ynj00ct-G " >
5
+ <img src =" https://i.ibb.co/9y2SgmS/f-P5-Or-Gkxk0-Ynj00ct-G.webp " alt =" f-P5-Or-Gkxk0-Ynj00ct-G " border = " 0 " >
6
6
7
7
Features
8
8
----------
@@ -88,14 +88,14 @@ models.py
88
88
89
89
``` python
90
90
from django.db import models
91
- from django_chunk_file_upload.models import FileManagerMixin
91
+ from django_chunk_file_upload.models import FileManager
92
92
93
93
94
94
class Tag (models .Model ):
95
95
name = models.CharField(max_length = 255 )
96
96
97
97
98
- class YourModel (FileManagerMixin ):
98
+ class YourModel (FileManager ):
99
99
tags = models.ManyToManyField(Tag)
100
100
custom_field = models.CharField(max_length = 255 )
101
101
@@ -116,7 +116,6 @@ class YourForm(ChunkedUploadFileForm):
116
116
117
117
views.py
118
118
119
- Accepted methods: GET, POST, DELETE (UPDATE, PUT does not work with FormData).
120
119
``` python
121
120
from django_chunk_file_upload.views import ChunkedUploadView
122
121
from django_chunk_file_upload.typed import File
@@ -127,18 +126,12 @@ from .forms import YourForm
127
126
class CustomChunkedUploadView (ChunkedUploadView ):
128
127
form_class = YourForm
129
128
permission_classes = (IsAuthenticated,)
130
-
131
129
# file_class = File # file class
132
- # file_status = app_settings.status # default: PENDING (Used when using background task, you can change it to COMPLETED.)
133
130
# optimize = True # default: True
134
131
# remove_file_on_update = True # update image on admin page.
135
132
# chunk_size = 1024 * 1024 * 2 # custom chunk size upload (default: 2MB).
136
133
# upload_to = "custom_folder/%Y/%m/%d" # custom upload folder.
137
134
# template_name = "custom_template.html" # custom template
138
-
139
- # # Run background task like celery when upload is complete
140
- # def background_task(self, instance):
141
- # pass
142
135
```
143
136
144
137
custom_template.html
0 commit comments