with uploaded_file.open() as f:
form.instance.file.save(uploaded_file.name, File(f))
return super().form_valid(form)
class CaseDetail(DetailView):
model = Case
After Change
def form_valid(self, form):
form.instance.creator = self.request.user
redirect = super().form_valid(form)
for uploaded_file in form.cleaned_data["chunked_upload"]:
with uploaded_file.open() as f:
case_file = CaseFile.objects.create(
case=self.object,
)
case_file.file.save(uploaded_file.name, File(f))
return redirect
class CaseDetail(DetailView):
model = Case