I have a Django form modalform. There is an image field in it. The issue is that when the user clicks on the clear image, the image is removed from the models, but when the html file tries to retrieve the image, an error message appears The 'image' attribute has no file associated with it.
So I'm planning to remove the clear button from django forms or is there any other best practises?
CodePudding user response:
{% if obj.image %}
<img src="{{ obj.image.url }}">
{% else %}
your html content which you want to display after removing picture.
{% endif %}