cannot import name 'detail_route' from 'rest_framework.decorators'
Asked Answered
H

1

6

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'
Hinge answered 2/8, 2019 at 2:35 Comment(0)
A
23

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):
   ....
Assessment answered 2/8, 2019 at 4:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.