linhaohong 4 сар өмнө
parent
commit
dec98d045d

+ 10 - 2
AdminController/AlgorithmShopManageController.py

@@ -132,10 +132,18 @@ class AlgorithmShopManageView(View):
                 device_algorithm_explain_qs = DeviceAlgorithmExplain.objects.filter(
                     algorithm_type_id=device_algorithm_type.id)
                 translation_num = device_algorithm_explain_qs.count()
-                device_algorithm_explain = device_algorithm_explain_qs.filter(lang="cn").first()
+                device_algorithm_explain = device_algorithm_explain_qs.filter(lang='cn').values("title")
+                if device_algorithm_explain.exists():
+                    title = device_algorithm_explain[0]["title"]
+                else:
+                    device_algorithm_explain = device_algorithm_explain_qs.values("title")
+                    if device_algorithm_explain.exists():
+                        title = device_algorithm_explain[0]["title"]
+                    else:
+                        title = ""
                 device_algorithm_type_list.append({
                     "algorithmId": device_algorithm_type.id,
-                    "title": device_algorithm_explain.title if device_algorithm_explain.title else "",
+                    "title": title,
                     "algorithmType": device_algorithm_type.type,
                     "memory": device_algorithm_type.memory,
                     "downCount": device_algorithm_type.down_count,