Open marojenka opened 7 years ago
Thanks @marojenka for your solution, I had the same issue. To expand your post, here is my full solution to run validators with multiple files:
# my_project/fields
from multiupload.fields import MultiImageField
class ValidatedMultiImageField(MultiImageField):
def run_validators(self, value):
value = value or []
for item in value:
super().run_validators(item)
# usage in forms.py:
class FooModelForm(forms.ModelForm):
attachments = ValidatedMultiImageField()
# ...
Thanks for hint with validator. Do you guys have an example how to use multiupload with formsets? I spent on that solution 2 days and it doesn't work to me and I didn't found code with combination multiupload and formsets.
Thanks a lot K
My general approach with formsets is not to use formsets. It's hard for me to help you without seeing your code but I don't think it's a proper place for it.
Thanks @marojenka, I came across this as well. Can we create a PR for fixing this?
@dreaquil hello, it's been a while and I don't use this app so I'm not entirely sure if this is still a case. What version of Django and this app are you using? I suspect that #41 might be related.
Hi @marojenka,
I'm currently on Django 3.2 and django-multiupload 0.6.1. You're right, #41 is identical as it is the issue that lead me to this one.
hi, love the app. Work with validators was strange for me since app sends all data as one list while validators usually expect single element so I used custom interface for validators defined as an argument for MultiuploadField. Since version 1.11 django claim to use default validator for ImageField and in one of early releases they actually set it and it broke MultiImageField and such. Problem is the same: MultiuploadField send list to Image validators while they expect single element so something like
will allow MultiUploadMetaField to work out of box. cheers o/