当打印反序列化对象时报错:AssertionError: When a serializer is passed a `data` keyword argument you must call `.is_valid()` before attempting to access the serialized `.data` representation.

AssertionError: When a serializer is passed a `data` keyword argument you must call `.is_valid()` before attempting to access the serialized `.data` representation.
You should either call `.is_valid()` first, or access `.initial_data` instead.

报错原因是:

 

 解决办法:

  只要不要打印ser.data即可

posted @ 2022-06-17 17:57  Mr_胡萝卜须  阅读(379)  评论(0编辑  收藏  举报