fix / add serial_number to get-detectors route
This commit is contained in:
@@ -32,7 +32,7 @@ class DetectorSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = Sensor
|
||||
fields = ('detector_id', 'type', 'name', 'object', 'status', 'zone', 'floor', 'notifications')
|
||||
fields = ('detector_id', 'type', 'serial_number', 'name', 'object', 'status', 'zone', 'floor', 'notifications')
|
||||
|
||||
def get_detector_id(self, obj):
|
||||
return obj.name or f"{obj.sensor_type.code}-{obj.id}"
|
||||
|
||||
@@ -28,6 +28,7 @@ class SensorView(APIView):
|
||||
"object": "Объект 1",
|
||||
"status": "warning",
|
||||
"zone": "Зона 1",
|
||||
"serial_number": "GA-123",
|
||||
"floor": 1,
|
||||
"notifications": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user