Before Release 27 March
This commit is contained in:
@@ -217,6 +217,7 @@ class Sistema_CreateView(CreateView):
|
||||
'''
|
||||
|
||||
class GetDeviceToken(APIView):
|
||||
"""Recobra el Token DRF del Device"""
|
||||
authentication_classes= [TokenAuthentication]
|
||||
permissions_classes=[IsAuthenticated, HasAuthorizationHeader]
|
||||
def post(self,request):
|
||||
@@ -229,7 +230,7 @@ class GetDeviceToken(APIView):
|
||||
ip_address=data.get('ip_address'),
|
||||
sistema= sis.id,#data.get('sistema'),
|
||||
macAddress=data.get('macAddress')
|
||||
).first()
|
||||
).first()
|
||||
if device is not None:
|
||||
token = {"token":str(device.token)}
|
||||
else:
|
||||
@@ -242,11 +243,10 @@ class GetDeviceToken(APIView):
|
||||
traceback=traceback.format_exc(),
|
||||
view='Sistemas.GetDeviceToken'
|
||||
)
|
||||
return Response(
|
||||
{'Error':f'{ex}','isError':True}
|
||||
, status=status.HTTP_200_OK)
|
||||
return Response({'Error':f'{ex}','isError':True}, status=status.HTTP_200_OK)
|
||||
|
||||
class RegisterDeviceView(APIView):
|
||||
"""Registra al Device"""
|
||||
permissions_classes = (permissions.AllowAny,)
|
||||
|
||||
def post(self,request):
|
||||
@@ -260,11 +260,12 @@ class RegisterDeviceView(APIView):
|
||||
except Exception as ex:
|
||||
BitacoraErrores.objects.create(level=2, message=str(ex), traceback=traceback.format_exc(),
|
||||
view='Sistemas.RegisterDeviceView')
|
||||
return Response(
|
||||
{'Error':f'{ex}','isError':True}
|
||||
, status=status.HTTP_200_OK)
|
||||
return Response({'Error':f'{ex}','isError':True}
|
||||
, status=status.HTTP_200_OK
|
||||
)
|
||||
|
||||
class AuthenticateDeviceView(APIView):
|
||||
"""Autentica al device"""
|
||||
authentication_classes= [TokenAuthentication]
|
||||
permissions_classes=[IsAuthenticated, HasAuthorizationHeader]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user