Thursday, July 8, 2021

image storing to database

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()

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAAecFsM8eSwpY%3DRNXkNn5bQtde9zNOb-tyE-fJDuK8OXio3Tw%40mail.gmail.com.

No comments:

Post a Comment