Correct problem with multi select
authorymh <ymh.work@gmail.com>
Wed, 05 Feb 2014 17:35:53 +0100
changeset 342 8648456307ae
parent 341 9b7682bc6f0c
child 343 0d37175fa6a1
Correct problem with multi select
src/jocondelab/views/front_office.py
--- a/src/jocondelab/views/front_office.py	Wed Feb 05 13:32:41 2014 +0100
+++ b/src/jocondelab/views/front_office.py	Wed Feb 05 17:35:53 2014 +0100
@@ -188,13 +188,14 @@
                 if page == 1 and len(dbpedia_uris) == 1 and len(fs) > 0:
                     context["wkinfo"] = fs[0]
                 term_filters = Q()
+
                 for term_ids in fields_hash.values():
-                    term_filter_term = Q(noticeterm__term_id__in=term_ids)
-                    if operator == "and":
-                        term_filters &= term_filter_term
+                    if operator == "and" :
+                        qs = qs.filter(noticeterm__term_id__in=term_ids)
                     else:
-                        term_filters |= term_filter_term
-                qs = qs.filter(term_filters)
+                        term_filters |= Q(noticeterm__term_id__in=term_ids)
+                if operator == "or" :
+                    qs = qs.filter(term_filters)
             
             count_qs = qs
             qs = qs.filter(noticeterm__term__validated=True)