I have a formset that returns empty cleaned_data, even though the formset is valid. my view is like this:
def edit_files(request):
file_formSet = formset_factory(FileUploadForm)
if request.POST:
formset = file_formSet(request.POST, request.FILES)
if formset.is_valid():
for form in formset:
form_data = form.cleaned_data
if form_data:
up_file = upload_file(form_data['file'])
else:
formset = file_formSet()
return render_to_response('edit_files.html', {'formset': formset})
it is an upload form and with this problem I can't save files upload_file is one of my implemented methods and it works fine, I have tested this.
ok, i just wanna complete the topic so if anyone has the same problem, he/she can use this page to solve it main keys to this solution are: 1- never forget the encryption type 2- use separate forms for different functionality
so in the template i should use:
and use two separate forms for add and delete files like this: this one for adding files:
and this one for deleting files: