my model.py as follows,
class Employee(models.Model):
id = models.IntegerField(max_length = 6,primary_key=True,verbose_name="Employee ID")
name = models.CharField(max_length = 100,verbose_name="Name")
image = models.ImageField(upload_to = ".",blank=True,null=True)
When i try to add image in django admin, it uploads the image to /site_media/media. Here i want to replace the uploaded image name with my primary key field ID.jpeg, so that i can retrieve and show that in html pages .
Even now i can retrieve the image name because its stored in db. However for simplifying i need to customize the image name before upload. Also if the user uploads another image for same person it should overwrite the old one. At present it just changes the new name in db. But still old image is present in the media folder