How to display default filefield value when editing records in django?
I开发者_如何学运维 have a ModelForm with an additional filefield in it, now I can submit the form and the file is being uploaded the way I wanted also the records are being saved.
The problem is that when I'm editing, the filefield appears empty. How do I make it so it displays the current file uploaded on the record being edited?
I don't think <input type="file" />
fields work that way. They are strictly upload only. If you were to put a value in it, when the form is submitted it would attempt to resolve that value to a local path on your computer and upload that file. A better solution would be to display the name of the file attached to the current record with static text, and only show the <input type="file" />
field when uploading a new file.
精彩评论