Answers for "django send and receive image data to react"

0

django send and receive image data to react

class ProductSerializer(serializers.ModelSerializer):
  class Meta:
    model = Product
    fields= ('id', 'item_title', 'item_desc', 'item_price', 'item_image_url')
Posted by: Guest on February-28-2021
0

django send and receive image data to react

class Product(models.Model):
  item_title= models.CharField(max_length=50)
  item_desc=models.TextField()
  item_price=models.IntegerField()
  item_image=models.ImageField(upload_to='post_images',default='default.png')
  item_image_url = models.TextField()
Posted by: Guest on February-28-2021
0

django send and receive image data to react

def save(self):
        encodedString = base64.b64encode(self.item_image.file.read())
        data = {"key": os.environ.get("IMG_BB"), "image": encodedString.decode("utf-8")}
        uploadedImageInfo = requests.post("https://api.imgbb.com/1/upload", data=data)
        jsonResponse = json.loads(uploadedImageInfo.text)
        self.item_image_url = jsonResponse["data"]["display_url"]
        super().save()
Posted by: Guest on February-28-2021

Code answers related to "django send and receive image data to react"

Code answers related to "Javascript"

Browse Popular Code Answers by Language