美文网首页
2019-06-06 django-rest-framework

2019-06-06 django-rest-framework

作者: 多吃水果少吃肉 | 来源:发表于2019-06-06 09:54 被阅读0次

    添加 manytomany 对象, SerializerModelSerializer 是最方便的, 如果使用 HyperlinkedModelSerializer 则 manytomany 应该传递的是对象的 link

    image.png

    否则会报错: type error expected url string received int or 类型错误。期望为URL字符串,实际的类型是 int。

    参考连接: https://stackoverflow.com/questions/36456328/django-throwing-incorrect-type-expected-url-string-on-api-call

    相关文章

      网友评论

          本文标题:2019-06-06 django-rest-framework

          本文链接:https://www.haomeiwen.com/subject/oglyxctx.html