Answer the question
In order to leave comments, you need to log in
How to initialize a file type field in a django form if the value is already there?
There is an instance of the model with a file. The file has been downloaded to disk.
Question: how to regularly generate a form to update the model? The bottom line is that, apparently, it is necessary to substitute the entire existing file into it. Are there any other options, without having to read the full content of the file and send it to the client in a form (or whatever it is)?
Answer the question
In order to leave comments, you need to log in
It's impossible. The browser security system allows you to set the values of input fields of the file type only as a result of the user performing a sequence of actions in the form of pressing a button and selecting a file. You just have to display some marker next to the field that the file has already been uploaded.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question