Correcciones en nombre sea de dios
This commit is contained in:
@@ -44,13 +44,13 @@ class DeviceSerializer(serializers.ModelSerializer):
|
||||
& Q(macAddress__icontains=mac_address)
|
||||
& Q(database=self.context['request'].data.get('database'))
|
||||
)
|
||||
|
||||
print('existing_devices', existing_devices)
|
||||
if existing_devices.exists():
|
||||
# A device with the same macAddress already exists for the given sistema and client
|
||||
# Get the number of existing devices and add 1 to create a new suffix
|
||||
suffix = existing_devices.count() + 1
|
||||
mac_address += f'_{suffix}'
|
||||
|
||||
print('suffix mac_address',mac_address)
|
||||
validated_data['macAddress']= mac_address
|
||||
return super().create(validated_data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user