2025-05-04 15:24:28 +03:30
|
|
|
from apps.authentication.api.v1.serializers.jwt import CustomizedTokenObtainPairSerializer
|
2025-05-05 15:25:46 +03:30
|
|
|
from rest_framework_simplejwt.authentication import JWTAuthentication
|
2025-05-04 15:24:28 +03:30
|
|
|
from rest_framework_simplejwt.views import TokenObtainPairView
|
|
|
|
|
from rest_framework.viewsets import ModelViewSet
|
|
|
|
|
from rest_framework.decorators import action
|
|
|
|
|
from apps.authentication.models import User
|
2025-05-06 16:22:35 +03:30
|
|
|
from rest_framework.views import APIView
|
2025-05-04 15:24:28 +03:30
|
|
|
from django.db import transaction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CustomizedTokenObtainPairView(TokenObtainPairView):
|
|
|
|
|
serializer_class = CustomizedTokenObtainPairSerializer
|
|
|
|
|
|
|
|
|
|
|
2025-05-05 15:25:46 +03:30
|
|
|
# Example Code
|
2025-05-04 15:24:28 +03:30
|
|
|
class Authentication(ModelViewSet):
|
|
|
|
|
queryset = User
|
|
|
|
|
serializer_class = ''
|
|
|
|
|
permission_classes = ''
|
2025-05-05 15:25:46 +03:30
|
|
|
authentication_classes = [JWTAuthentication]
|
2025-05-04 15:24:28 +03:30
|
|
|
|
|
|
|
|
@action(
|
|
|
|
|
methods=['post', ],
|
|
|
|
|
detail=False,
|
|
|
|
|
name='login',
|
|
|
|
|
url_name='login',
|
|
|
|
|
url_path='login'
|
|
|
|
|
)
|
|
|
|
|
@transaction.atomic
|
|
|
|
|
def login(self, request):
|
|
|
|
|
pass
|
2025-05-06 16:22:35 +03:30
|
|
|
|
|
|
|
|
|
|
|
|
|
class UserViewSet(ModelViewSet):
|
|
|
|
|
pass
|