DropArea shows "undefined" while editing a ModelForm without input_file inputed
Closed this issue · 3 comments
yanhuixie commented
Yes, I have just change input_file of Example Model to "blank=True, null=True".
class Example(models.Model):
fs = FileSystemStorage(location=settings.MEDIA_ROOT)
title = models.CharField(max_length=255)
input_file = models.FileField(max_length=255, upload_to="example", storage=fs, blank=True, null=True)
def __str__(self):
return self.title
Because we make it not required that the file to be uploaded.
const getInitialFiles = fieldName => {
const data = getInputValue(getUploadsFieldName(fieldName, getPrefix()));
if (!data) {
return [];
}
return JSON.parse(data);
};
if (!data) { I think It (!data) could be the cause of the problem. In this scenario, the "data" is [{}], that an empty object within an empty array.
mbraak commented
I'll have a look
mbraak commented
This is fixed in version 3.7.0