Chive / django-multiupload

Dead simple drop-in multi file upload field for Django forms using HTML5's multiple attribute.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'list' object has no attribute 'name'

sanatwagh opened this issue · comments

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

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

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.

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!

@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

@sanatwagh Could you please reopen the issue?

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 #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