un1t / django-file-resubmit

It remembers selected files in form on validation errors.
76 stars 39 forks source link

FileForm field widget not working #21

Open jlariza opened 6 years ago

jlariza commented 6 years ago

Good day,

I am using the library as following

from file_resubmit.widgets import ResubmitFileWidget

class FileModelForm(forms.ModelForm):

    class Meta:
        model = FileModel
        fields = [
            ...,
            'original_file',
        ]
        widgets = {
            'original_file': ResubmitFileWidget
        }

and my settings are:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    },
    "file_resubmit": {
        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
        "LOCATION": '/tmp/file_resubmit/'
    },
}

When a validation error raises, the file appears but it is not selected at the field; I need to reselect it again from my computer.

image

What am I missing to make it work? Thank you,

luyidong commented 6 years ago

+1

fmeoli commented 5 years ago

+1

fmeoli commented 5 years ago

+1

pixelead0 commented 5 years ago

+1