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