Answer the question
In order to leave comments, you need to log in
How to make ImageField not required in form.is_valid() in django if the image has already been uploaded before?
Actually there is a form for filling in data, passport data. If it has already been filled in, then I pull the user's values from the database and substitute them in the form. All fields are required, however, when the user wants to change the data again, for example, the first or last name, they also require an image, because the file with it may be lost, or the user logs in from another PC.
So far, I have parsed the html form, and after checking user.img.url, I deleted it, or left the required attribute. However, in views, the check of the form for validity in this case does not pass. Actually, how can you update all fields except imgfield using django? Or will you have to extract all the data from the form and update the database based on what has come?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question