Changes between Version 3 and Version 4 of Ticket #25756, comment 2


Ignore:
Timestamp:
Jan 5, 2016, 6:37:53 AM (8 years ago)
Author:
Riccardo Di Virgilio

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25756, comment 2

    v3 v4  
    1 Hi, I'm implementing an ArrayField and I can attach a "working" and very dirty implementation.
     1Hi, I need to implement an array field for multiple files, and currently this is not supported.
    22
    3 I would like to share here why this is not working after several hours of debug.
     3https://code.djangoproject.com/ticket/25756
    44
    5 So far I found several problems:
     5after hours of debugging I found out several design problems that are preventing to have a clean implementation of this field.
    66
    771. If you use a FileField this field is using a descriptor to transform strings into File objects (instead of to_python), which is why the array field is always returning strings and not file objects.
     
    1010
    11113. the pre save method in file field is the one that is actually saving the file, since ArrayField is not calling the super of that, this cannot work.
     12
     13
     14array field should  support file field out of the box (and this involves also creating a multi file input widget that can work also in the admin).
     15
     16another solution is to have a special ArrayFileField, which can also return an ArrayFile object that is iterable (instead of a list).
     17
     18I can attach a "working" and dirty version of it.
Back to Top