Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot import name 'detail_route' from 'rest_framework.decorators'

I'm trying to run longclaw, but i get an error

$ python manage.py makemigrations catalog home

Traceback (most recent call last):
[...]
 File "/lib/python3.7/site-packages/longclaw/basket/api.py", line 1, in <module>
   from rest_framework.decorators import detail_route, list_route
ImportError: cannot import name 'detail_route' from 'rest_framework.decorators'
like image 615
netro netroo Avatar asked Dec 02 '22 09:12

netro netroo


1 Answers

Its because detail_route has been deprecated from DRF 3.8. You can check their change-log as well. Alternatively, you can use actions decorator. For example:

from rest_framework.decorators import action

@action(detail=True, methods=['post'])
def set_password(self, request, pk=None):
   ....
like image 119
ruddra Avatar answered Dec 04 '22 00:12

ruddra