[Answered ]-Django template: submit form after file upload

2👍

since your question was a little vague, so is this answer

You will have to upload file over ajax first, then get the pk of that uploaded file in ajax response.. Hit submit. Then again get the instance of that file using its pk.

file_instance = File.objects.get(pk=pk)

And save the

Form(initial={'file': file_instance}, data=request.POST).save()

And you might wanna take upload field out of your form to avoid double submission

Leave a comment