shot_list 去重

FFIB 2 年 前
コミット
97bb4778e9
共有1 個のファイルを変更した2 個の追加2 個の削除を含む
  1. 2 2
      api/tenancy_views.py

+ 2 - 2
api/tenancy_views.py

@@ -21,8 +21,8 @@ from utils.kuaidi.subscribe import KuaiDi100 as KuaiDi100Subscribe
21 21
 
22 22
 @logit
23 23
 def shot_list(request):
24
-    shots = TenancyShotInfo.objects.values('model_id').filter(tenancy_status=0, status=True).order_by('model_id')
25
-    shots = [shot['model_id'] for shot in shots]
24
+    shots = TenancyShotInfo.objects.values_list('model_id', flat=True).filter(tenancy_status=0, status=True).order_by('model_id')
25
+    shots = set(shots)
26 26
     shots = ModelInfo.objects.filter(model_id__in=shots)
27 27
     shots = [shot.admindata for shot in shots]
28 28