core: fix api signature for view_key

This commit is contained in:
Jens Langhammer 2020-10-19 14:35:22 +02:00
parent 5d7220ca70
commit 386e23dfac
1 changed files with 2 additions and 5 deletions

View File

@ -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()