Chive / django-multiupload

Dead simple drop-in multi file upload field for Django forms using HTML5's multiple attribute.
MIT License
279 stars 81 forks source link

'list' object has no attribute 'name' #41

Closed sanatwagh closed 3 years ago

sanatwagh commented 4 years ago

After changing renderer=None in fields.py, form is visible but wen we submit form it says 'list' object has no attribute 'name'

hussu010 commented 4 years ago

same is true for me :( has anyone came across the same problem?

Kiel-Hyre commented 4 years ago

same here

errors logs stop here.

File "/usr/local/lib/python3.6/dist-packages/django/core/validators.py", line 516, in validate_image_file_extension return FileExtensionValidator(allowed_extensions=get_available_image_extensions())(value) File "/usr/local/lib/python3.6/dist-packages/django/core/validators.py", line 485, in call extension = Path(value.name).suffix[1:].lower()

my code

class XForm(forms.Form):
    attachments = MultiImageField(min_num=1, max_num=3, max_file_size=1024*1024*5)

# yes i just test it, and this happened.
Chive commented 3 years ago

I'm not able to reproduce this on the supported django versions (2.2/3.1/3.2). Please reopen if it's still an issue!

modbender commented 3 years ago

@Chive The same happens to me, I'm trying to use the form in admin, overriding default generated ModelForm. I need to override is_valid or full_clean from ModelForm to try and fix this, but there's just too much data in there and I don't know which to change or edit.

Simple example:


@admin.register(ExampleModel)
class ExampleModelAdmin(admin.ModelAdmin):
    form = AttachmentForm
modbender commented 3 years ago

@sanatwagh Could you please reopen the issue?

DmytroLitvinov commented 2 years ago

Hi @Chive , I also have that problem. Django 3.2, Python 3.8. I am trying to upload multiple files in the input with MultiImageField.

Here is an example of form:

class SupplierMediaForm(forms.Form):
    files = MultiImageField(
        label=_('Choose images to upload'),
        min_num=1,
        max_num=MAX_IMAGES_NUM,
        max_file_size=1024 * 1024 * MAX_IMAGE_SIZE,
    )

The solution for that problem is provided in that comment. I am happy to provide https://github.com/Chive/django-multiupload/pull/49 to fix that issue. Could you please review it, merge and release it to PyPI?

Also, if you need any help from my side, please let me know. I can manage that repo as a collaborator and can be one of maintainer at PyPI