I'm a little stuck, I've been using Django for some time, but actually I can't find this thing. And this is strange, because it should be simple.
I was looking for search queries and could not find a solution, perhaps because it is simple.
The problem is that I have a ModelForm and I have a FileField, when I render this form with an instance of the model and the object contains the downloaded file, I would like to show the current file (for example, admin does), but I cannot do it .
None of these methods work:
{{ form.as_p }}
{{ field.label_tag }}
I searched in admin templates but cannot find the magic. The form displays all other object data correctly
Problem number 2 is that since the downloaded file does not appear when visualizing the change form with an instance of the object, the forms are not checked when I try to save, because it does not know anything about the previously downloaded file.
So, how do you handle file fields in the form of changes in Django, how to show the currently loaded file, and how to validate the form.
source
share