|
@@ -1,6 +1,7 @@
|
|
|
#!/usr/bin/env python3
|
|
|
# -*- coding: utf-8 -*-
|
|
|
import json
|
|
|
+import operator
|
|
|
import time
|
|
|
from bisect import bisect_left
|
|
|
|
|
@@ -498,15 +499,15 @@ class DeviceManagement(View):
|
|
|
model=F('app_device_type__model'), type=F('app_device_type__type'), icon=F('app_device_type__icon'),
|
|
|
name=F('app_device_type__devicenamelanguage__name'),
|
|
|
sort=F('app_device_type__devicenamelanguage__sort'),
|
|
|
- app_version_number_id=F('app_device_type__app_version_number_id')).order_by(
|
|
|
- 'app_device_type__devicenamelanguage__sort').values('model', 'type', 'icon', 'name', 'sort',
|
|
|
- 'app_device_type__app_version_number_id')
|
|
|
+ app_version_number_id=F('app_device_type__app_version_number_id')).values('model', 'type', 'icon',
|
|
|
+ 'name', 'sort',
|
|
|
+ 'app_device_type__app_version_number_id')
|
|
|
dvr_list = [app_bundle for app_bundle in app_bundle_qs if app_bundle['model'] == 1]
|
|
|
ipc_list = [app_bundle for app_bundle in app_bundle_qs if app_bundle['model'] == 2]
|
|
|
print(dvr_list, ipc_list)
|
|
|
res = {
|
|
|
- 'deviceDvr': dvr_list,
|
|
|
- 'deviceIpc': ipc_list,
|
|
|
+ 'deviceDvr': sorted(dvr_list, key=operator.itemgetter('sort')),
|
|
|
+ 'deviceIpc': sorted(ipc_list, key=operator.itemgetter('sort')),
|
|
|
}
|
|
|
return response.json(0, res)
|
|
|
except Exception as e:
|
|
@@ -559,9 +560,9 @@ class DeviceManagement(View):
|
|
|
model=F('app_device_type__model'), type=F('app_device_type__type'), icon=F('app_device_type__icon'),
|
|
|
name=F('app_device_type__devicenamelanguage__name'),
|
|
|
sort=F('app_device_type__devicenamelanguage__sort'),
|
|
|
- app_version_number_id=F('app_device_type__app_version_number_id')).order_by(
|
|
|
- 'app_device_type__devicenamelanguage__sort').values('model', 'type', 'icon', 'name', 'sort',
|
|
|
- 'app_device_type__app_version_number_id')
|
|
|
+ app_version_number_id=F('app_device_type__app_version_number_id')).values('model', 'type', 'icon',
|
|
|
+ 'name', 'sort',
|
|
|
+ 'app_device_type__app_version_number_id')
|
|
|
for app_bundle in app_bundle_qs:
|
|
|
app_bundle_list.append({
|
|
|
'model': app_bundle['model'],
|
|
@@ -575,9 +576,10 @@ class DeviceManagement(View):
|
|
|
ipc_list = [app_bundle for app_bundle in app_bundle_list if app_bundle['model'] == 2]
|
|
|
print(dvr_list, ipc_list)
|
|
|
res = {
|
|
|
- 'deviceDvr': dvr_list,
|
|
|
- 'deviceIpc': ipc_list,
|
|
|
+ 'deviceDvr': sorted(dvr_list, key=operator.itemgetter('sort')),
|
|
|
+ 'deviceIpc': sorted(ipc_list, key=operator.itemgetter('sort')),
|
|
|
}
|
|
|
+
|
|
|
return response.json(0, res)
|
|
|
except Exception as e:
|
|
|
print(e)
|