I have an ImageField for a "People" model..
from django.db import models
class People(models.Model):
firstname = models.CharField(max_length=100)
lastname = models.CharField(max_length=100)
img = models.ImageField(upload_to='media/people')
The problem is, when I try to add a people object through Django Admin, and I select an image file, Django admin adds weird characters (that looks like a hash value) at the end of the image, which causes the image to not appear on the website..
For example, this is my Django Admin page for adding people:
When I click save and check my admin, this is what appears:
As you can see, it added "_PQSSbcg" at the end of the image name for some reason.. Because of this, the website fails to display the image, because the template tries to find "jose_atria.jpg"..
Why is Django Admin adding this extra characters, and how do I get rid of this?
Thanks
Addition of the random extra characters is because you have uploaded files with same name twice.
Deleting the previous existing file before uploading it again will help you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With