'django-rest-framework: invalid regular expression in url_path
I have a view and action defined in it:
class V(mixins.UpdateModelMixin, GenericViewSet):
`` some codes``
lookup_field = 'uuid'
@action(detail=True, methods=['put'], permission_classes=[IsAdminUser], url_path='approve/(?P<uuid>[\w-]+)')
def approve(self, request, *args, **kwargs):
obj = self.get_object()
`` some codes ``
The app doesn't run because of:
django.core.exceptions.ImproperlyConfigured: "^url/(?P[^/.]+)/approve/(?P[\w-]+)/$" is not a valid regular expression: redefinition of group name 'uuid' as group 2; was group 1 at position 46
urls.py in the app directory:
router = routers.DefaultRouter()
router.register(r'url', views.V, basename='url')
The correct configuration would be like ^url/approve/(?P<uuid>[\w-]+)/$, but as the error says, it's another pattern and I don't mean it. Any idea would be appreciated
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
