I currently have something like this
querySet = modelEmployee.objects.all() employeesJson = Serializer_ListEmployee(querySet,many=True).data mydict["employers"] = employeesJson; The problem with this is that value of the imageField is actually an image and I would like to get a base64 string instead.This is what the model looks like
class modelEmployee(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, null=True, blank=True) employee_image = models.ImageField(upload_to='images/',null=True,blank=True,default='images/') employee_zip = models.IntegerField(default=0) and this is my serializer
class Serializer_ListEmployee(ModelSerializer): user = Serializer_CreateOrListUserSerializer_ListUser() class Meta: model = modelEmployee fields = [ 'user', 'employee_zip', 'employee_image', ] Any suggestions on how I can get back a base64 encoded string instead ?