根據Django文檔,ChoiceField接受an iterable of two tuples, "or a callable that returns such an iterable"作爲該字段的選項。 我我的表格中定義ChoiceFields: class PairRequestForm(forms.Form):
favorite_choices = forms.ChoiceF
下面我有一個簡單的模型不同orderingfilter: class Ingredient(models.Model):
name = models.CharField(max_length=30)
我使用Django的休息框架API端點。 class IngredientListAPIView(ListAPIView):
queryset = Ingredient.obj
我試圖接受一個圖像文件已經發布使用我的基於POST API的Django REST函數。這是基於https://github.com/m-haziq/django-rest-swagger-docs 我收到此錯誤截圖(https://imgur.com/a/ECq5y) Object of type 'TypeError' is not JSON serializable
這樣做 face_i