core: fix api signature for view_key
This commit is contained in:
parent
5d7220ca70
commit
386e23dfac
|
@ -1,6 +1,4 @@
|
|||
"""Tokens API Viewset"""
|
||||
from uuid import UUID
|
||||
|
||||
from django.http.response import Http404
|
||||
from rest_framework.decorators import action
|
||||
from rest_framework.request import Request
|
||||
|
@ -29,10 +27,9 @@ class TokenViewSet(ModelViewSet):
|
|||
serializer_class = TokenSerializer
|
||||
|
||||
@action(detail=True)
|
||||
# pylint: disable=invalid-name
|
||||
def view_key(self, request: Request, pk: UUID) -> Response:
|
||||
def view_key(self, request: Request, identifier: str) -> Response:
|
||||
"""Return token key and log access"""
|
||||
tokens = Token.filter_not_expired(pk=pk)
|
||||
tokens = Token.filter_not_expired(identifier=identifier)
|
||||
if not tokens.exists():
|
||||
raise Http404
|
||||
token = tokens.first()
|
||||
|
|
Reference in New Issue