image storing to database

13 views
Skip to first unread message

Aniket Gadge

unread,
Jul 8, 2021, 4:51:38 AM7/8/21
to django...@googlegroups.com
my project is to store the images to database after classified them
but when i process it storethe  images first time in folder but second time it not store thedata to data base

model.py
class Addhars(models.Model):

name = models.CharField(max_length=64)
images = models.ImageField(upload_to='Addhar')
process_id = models.ForeignKey(process_number, on_delete=models.CASCADE)

def __str__(self):
return self.name
views. py
images = request.FILES.getlist('Images')

imageInfo = Addhars(process_id=process_number.objects.latest('process'), name='addhar card',
images=images[i])
imageInfo.save()
Reply all
Reply to author
Forward
0 new messages