locky %!s(int64=3) %!d(string=hai) anos
pai
achega
336adfa205
Modificáronse 1 ficheiros con 2 adicións e 3 borrados
  1. 2 3
      controller/LangWord.py

+ 2 - 3
controller/LangWord.py

@@ -230,13 +230,12 @@ class LangWordView(TemplateView):
                     # lk_qs = lk_qs.filter(word_key=searchVal)
                 else:
                     lk_qs = lk_qs.filter(langvalmodel__word_val__contains=searchVal, langvalmodel__la__lang=searchKey)
-            count = lk_qs.count()
-            # lk_qs = lk_qs[(page - 1) * line:page * line].values_list('word_key', flat=True)
             if orderByupdate == 1:
                 lk_qs = lk_qs.order_by('updTime')
             else:
                 lk_qs = lk_qs.order_by('-updTime')
-            lk_qs = lk_qs.values('word_key', 'updTime').distinct()[(page - 1) * line: page * line]
+            lk_qs = lk_qs.values('word_key', 'updTime').distinct()[(page - 1) * line: page * line]  # 去除重复word_key
+            count = len(lk_qs)
             k_list = []
             lw_dict = {}
             for lk in lk_qs: