Open AmeyKelekar opened 6 years ago
Me too , with Django 1.10.6
forms.py has following lines:
widgets = {
'file': AdminResubmitFileWidget,
}
resubmit to detect web content:
name="file_cache_key"
field already exists ,but it also prompts need to reselect the file
...
How to fix it?
Can you explain what exactly is happening? I've created a test project in Django 1.10.6 that mimics @AmeyKelekar 's post, but I don't have any problem uploading files via admin. While I do see the text that says "No File Selected"(I'll look into trying to remove that), it still retains the file for me.
I know why form https://github.com/un1t/django-file-resubmit/issues/2
@un1t said:
Hi! You can't set value to file input in browsers due to security reasons.
Therefore widget renders filename near a file input. If you have any ideas how to fix it let me know.
--
I need to customize page content to avoid duplicate input.
Hi,
I am referring https://github.com/un1t/django-file-resubmit that will help me not to reselect file on a Validation Error. But somehow I am not able to implement that functionality using 'file_resubmit'
I will share the steps followed: 1) pip install django-file-resubmit
2) In settings. py:
3) models.py has following line for file upload:
document_copy_of_CDA = models.FileField(upload_to='documents/%Y/%m/%d', validators=[validate_file_extension])
4) admin.py has following lines:
5) forms.py has following lines:
from file_resubmit.admin import AdminResubmitImageWidget, AdminResubmitFileWidget
Can you please check and let me know if I have to do any kind of modifications or addition to my exisiting code to take advantage of resubmit functionality? Thanks in advance. Looking forward to hearing from you.
Regards, Amey Kelekar