根据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