Skip to content

/musics/views.py中的detail函数 #3

Open
@JunKuang-algo

Description

@JunKuang-algo

新的框架中取消了from rest_framework.decorators import detail_route, list_route ,改成了from rest_framework.decorators import action .

@detail_route(methods=['get'])
def detail(self, request, pk=None):

这句会报TypeError, bool object is not callable错误

解决办法是更改函数名detail

我在运行这个tutorial的时候花了近30分钟的时间才找到这个错误,希望后面学习的人可以避免这个问题

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions