I am saving 4 images from the user (maybe it will be null). I do not want to save the images in a directory or folder,I need to save the images in db(mysql). The 'form.save' is working and after looking in db the blob is present but there is no data in it.Not only that the null is displaying as blob!
forms.py
class ClientCreateForm(ModelForm):
photo = forms.ImageField(required=False)
signature = forms.ImageField(required=False)
poi_image = forms.ImageField(required=False)
poa_image = forms.ImageField(required=False)
model.py
class Client(models.Model):
photo = models.ImageField(db_column='PHOTO', blank=True, null=True)
signature = models.ImageField(db_column='SIGNATURE', blank=True, null=True)
poi_image = models.ImageField(db_column='POI_IMAGE', blank=True, null=True)
poa_image = models.ImageField(db_column='POA_IMAGE', blank=True, null=True)
views.py
def client_create_view(request):
if request.method == 'POST':
form = ClientCreateForm(request.POST)
if form.is_valid():
form.save()
else:
pass