Correct Username search in get token view
This commit is contained in:
@@ -230,14 +230,21 @@ class GetDeviceToken(APIView):
|
|||||||
data = request.data
|
data = request.data
|
||||||
sis = Sistema.objects.get(nombre_sistema=data.get('sistema'))
|
sis = Sistema.objects.get(nombre_sistema=data.get('sistema'))
|
||||||
cli = Clientes.objects.get(RFC=data.get('client'))
|
cli = Clientes.objects.get(RFC=data.get('client'))
|
||||||
|
device_name= data.get('device_name')
|
||||||
|
ip_address = data.get('ip_address')
|
||||||
|
macAddress = data.get('macAddress')
|
||||||
|
username = f"Device_{cli.RFC}_{device_name}_{ip_address}_{macAddress}"
|
||||||
|
username = re.sub(r'\W+', '', username)
|
||||||
|
|
||||||
|
|
||||||
device = Device.objects.filter(
|
device = Device.objects.filter(
|
||||||
Q(client__id=cli.id)
|
Q(username__username__icontains=username)
|
||||||
& Q(macAddress=data.get('macAddress'))
|
# Q(client__id=cli.id)
|
||||||
& Q(device_name__icontains=data.get('device_name'))
|
# & Q(macAddress=data.get('macAddress'))
|
||||||
& Q(ip_address__icontains=data.get('ip_address'))
|
# & Q(device_name__icontains=data.get('device_name'))
|
||||||
& Q(sistema__id= sis.id)
|
# & Q(ip_address__icontains=data.get('ip_address'))
|
||||||
& Q(database=data.get('database'))
|
# & Q(sistema__id= sis.id)
|
||||||
|
# & Q(database=data.get('database'))
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if device is not None:
|
if device is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user