How to delete an ImageField image in a Django model
<p>I have a <code>Profile</code> model like so:</p>

<pre><code>class Profile(models.Model):
    photo = models.ImageField(upload_to="img/users/", blank=True)
</code></pre>

<p>I want my users to be able to remove their profile pictures so that there's no image in <code>photo</code> i.e blank.</p>

<p>I tried <code>Profile.objects.get(id=1).photo.delete(save=False)</code> which deleted the image but the url was still there so I was getting a 404. How do I clear the image and url?</p>

<p><strong>EDIT:</strong> In my template, I'm like:</p>

<pre><code>{% if profile.photo %}
    &lt;img src="{{ MEDIA_URL }}{{ profile.photo }}" /&gt;
{% else %}
    &lt;img src="{{ MEDIA_URL }}img/avatar.jpg" /&gt;
{% endif %}
</code></pre>