fix / add serial_number to get-detectors route

This commit is contained in:
Timofey
2025-10-16 13:01:11 +03:00
parent a9725e2276
commit aeda917001
4 changed files with 216 additions and 196 deletions

View File

@@ -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}"