Django Rest Framework - “Got a `TypeError` when calling `Note.objects.create()'”

前端 未结 1 500
终归单人心
终归单人心 2021-01-20 02:31

When i am trying to POST using the browsable API of DRF, i get the following error:

Got a TypeError when calling Note.objects.creat

1条回答
  •  耶瑟儿~
    2021-01-20 02:45

    I think this is because you are providing keyword argument data to save method. This is unnecessary. save() dont have such argument. Try just this:

    def perform_create(self, serializer):
        serializer.save()
    

    0 讨论(0)
提交回复
热议问题