0👍
✅
Maybe it’s not a correct way…
Don’t override save in forms.py and put create each new object in views after valid() like…
def list(request):
if request.method == 'POST':
form = MyUploadForm(request.POST, request.FILES)
if form.is_valid():
newdoc = form.cleaned_data['docfile']
for file_obj in request.FILES.getlist('docfile'):
Document.objects.create(docfile=file_obj)
return HttpResponseRedirect(reverse('multiupload.views.list'))
1👍
I will suggest you use pl-upload jQuery plugin, I personally use this plugin and this is pretty easy and uploading is very fast.
Here are some of example :
- [Answer]-How to get logged in user modelAdmin callable in django
- [Answer]-How do I populate the Django table MyApp_user_groups in a yaml fixture?
- [Answer]-Managing form manipulation by id javascript
Source:stackexchange.com