Why Django update() do not update image file in media folder, but update everything else in update process.. Old image is in media folder, but there is no new image in folder.. When creating (using save()) everything is fine.. Any help, thanks in advance...
Here is the model class:
class Company(models.Model):
name = models.CharField(max_length=100)
companyAddress = models.CharField(max_length=70)
companyPhoneNumber = models.CharField(max_length=30)
companyDescription = models.CharField(max_length=150)
companyProfileImage = models.ImageField(upload_to='images/', default = "images/defaultCompany.jpg", null = True)
Here is the code that I use when update:
newName = request.data['name']
newAddress = request.data['address']
newPhoneNumber = request.data['phoneNumber']
newDescription = request.data['description']
newCompanyProfileImage = request.data['image']
Company.objects.filter(id = companyId).update(name = newName, companyAddress = newAddress,
companyPhoneNumber = newPhoneNumber, companyDescription = newDescription, companyProfileImage = newCompanyProfileImage)