我有一個圖片字段使用django-rest-framework如何處理通過API上傳圖片?django-rest-framework和上傳圖片
有沒有什麼例子?
models.py
image = models.ImageField(
upload_to="profiles",
height_field="height",
width_field="width",
null=True,
blank=True,
editable=True,
help_text="Profile Picture",
verbose_name="Profile Picture"
)
height = models.PositiveIntegerField(null=True, blank=True, editable=False)
width = models.PositiveIntegerField(null=True, blank=True, editable=False)
http://stackoverflow.com/questions/ 11398696/upload-image-of-imagefield-with-djangorestframework-using-json-and-test-this-wit – catherine 2013-02-28 15:38:06