-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validation #23
Comments
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? Thanks a lot |
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? |
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/
The text was updated successfully, but these errors were encountered: