django.core.exceptions.ImproperlyConfigured: Field name `xxx` is not valid for model `xxx`.

0. 报错信息
django.core.exceptions.ImproperlyConfigured: Field name `preferential_title` is not valid for model `Course`
1. 报错信息描述
a. 在drf使用序列化器的时候,在model中自定义返回字段信息,报的错
2. 错误原因
a. 关于这种错误,都是自己定义的函数名称,添加到序列化的fields中时,写错了,导致序列化器找不到该字段
3. 解决办法
查看自己的字段名称,正确添加

django.core.exceptions.ImproperlyConfigured: Field name `xxx` is not valid for model `xxx`.最先出现在Python成神之路

版权声明:
作者:siwei
链接:https://www.techfm.club/p/16586.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>