File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 88
99urlpatterns  =  [
1010    path ('hello-view/' , views .HelloApiView .as_view ()),
11+     path ('login/' , views .UserLoginApiView .as_view ()),
1112    path ('' , include (router .urls ))
1213]
Original file line number Diff line number Diff line change 22from  rest_framework .response  import  Response 
33from  rest_framework  import  status , viewsets , filters 
44from  rest_framework .authentication  import  TokenAuthentication 
5+ from  rest_framework .authtoken .views  import  ObtainAuthToken 
6+ from  rest_framework .settings  import  api_settings 
57
68from  profiles_api  import  serializers 
79from  profiles_api  import  models 
@@ -109,3 +111,7 @@ class UserProfileViewSet(viewsets.ModelViewSet):
109111
110112    # once creating model serializer Django already knows the actions 
111113    # ex: list, craete, update.... 
114+ 
115+ class  UserLoginApiView (ObtainAuthToken ):
116+     """Hadnle creating user authentication token""" 
117+     renderer_classes  =  api_settings .DEFAULT_RENDERER_CLASSES 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments