]> git.parisson.com Git - telemeta.git/commitdiff
Autocompletion lieu + fix traduction
authormathieu <mathieu.boye28@gmail.com>
Mon, 9 May 2016 15:15:03 +0000 (17:15 +0200)
committermathieu <mathieu.boye28@gmail.com>
Mon, 9 May 2016 15:15:03 +0000 (17:15 +0200)
env/debug.env
telemeta/locale
telemeta/models/collection.py
telemeta/search_indexes.py
telemeta/templates/search/advanceSearch.html
telemeta/views/search.py

index a19e34770877c2c4104fc1cee497ee521afd6e88..7a9fbbcc2efd668f22107e8e9316a87bd0755b0f 100644 (file)
@@ -18,4 +18,4 @@ BROKER_URL=redis://broker:6379/0
 # If this is True, all tasks will be executed locally by blocking until the task returns.
 CELERY_ALWAYS_EAGER=False
 
-REINDEX=False
+REINDEX=True
index 308a1e8cfbeb2768f3e24660971d774e303e63b3..66caac4dce0b50451e5755e42240444ad33e9647 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 308a1e8cfbeb2768f3e24660971d774e303e63b3
+Subproject commit 66caac4dce0b50451e5755e42240444ad33e9647
index af421ebfac200884ee758d9bc0061b6f8814dd8b..419d765ca703fe830e980ffb5e741d07beaef14c 100644 (file)
@@ -198,7 +198,7 @@ class MediaCollection(MediaResource):
         elif '_E_' in self.public_id:
             return 'Published'
         else:
-            return ''
+            return 'Unknown'
 
     def get_url(self):
         return get_full_url(reverse('telemeta-collection-detail', kwargs={'public_id':self.pk}))
index fc7475ae8035727eaea6961ef07a28cab17eb1ab..537693002ecf5a4cc15d84d2bfb45ce95503e7d8 100644 (file)
@@ -75,7 +75,7 @@ class MediaItemIndex(indexes.SearchIndex, indexes.Indexable):
             #print u"".join(' ' + local for local in location).encode("utf-8")
             #print u"%s".encode("utf-8") % location
             #print [local for local in location]
-        return u"".join(' ' + local for local in location)
+        return u"".join('|' + local for local in location)
 
     def prepare_instruments(self, obj):
         item = MediaItemPerformance.objects.all().filter(media_item__exact=obj)
@@ -129,7 +129,7 @@ class MediaCollectionIndex(indexes.SearchIndex, indexes.Indexable):
             location = []
             if item.location is not None:
                 collec_location.append(item.location.name)
-        return u"".join(' ' + location for location in collec_location)
+        return u"".join('|' + location for location in collec_location)
 
     def prepare_location_relation(self, obj):
         collec_location = []
@@ -145,7 +145,7 @@ class MediaCollectionIndex(indexes.SearchIndex, indexes.Indexable):
                 for name in location:
                     if name and not name in collec_location:
                         collec_location.append(name)
-        return u"".join(' ' + location for location in collec_location)
+        return u"".join('|' + location for location in collec_location)
 
     def prepare_ethnic_group(self, obj):
         return "%s" % obj.ethnic_groups()
index 14e33079d984f2d9da6e16e5267afa212d126b5c..146536a3ce2cfe959b3f68dc5f44ea3848e4cad7 100644 (file)
@@ -324,7 +324,7 @@ $(function() {
 
 }
 
-    activerAutocompletion($('#id_code, #id_instruments, #id_collectors'));
+    activerAutocompletion($('#id_code, #id_instruments, #id_collectors, #id_location'));
 
     var colTri = [];
 
index 4b6f18fd68cd38116a31f39e84b5f372b8373e42..d6ee584f9469cf733c8875e5d1d70572ec10271a 100644 (file)
@@ -167,14 +167,20 @@ class HaystackAdvanceSearch(SavedSearchView):
 
 def autocomplete(request):
     sqs = SearchQuerySet().load_all()
-    if request.GET.get('attr', '') == "instruments":
-        sqs = sqs.filter(instruments__startswith=request.GET.get('q', ''))
-        instrus = [result.instruments for result in sqs]
+    if request.GET.get('attr', '') == "instruments" or request.GET.get('attr', '') == "location":
+        if request.GET.get('attr', '') == "instruments":
+            sqs = sqs.filter(instruments__startswith=request.GET.get('q', ''))
+            objets = [result.instruments for result in sqs]
+            #instrus = [result.instruments for result in sqs]
+        elif request.GET.get('attr', '') == "location":
+             sqs = sqs.filter(location_principal__startswith=request.GET.get('q', '')).filter_or(location_relation__startswith=request.GET.get('q', ''))
+             objets = [result.location_principal for result in sqs]
         suggestions = []
-        for chaine in instrus:
+        for chaine in objets :
+        #for chaine in instrus:
             for word in chaine.split('|'):
                 if word != "" and escapeAccentAndLower(request.GET.get('q', '')) in escapeAccentAndLower(word):
-                    suggestions.append(word)
+                     suggestions.append(word)
     elif request.GET.get('attr', '') == "code":
         sqs = sqs.filter(code__contains=request.GET.get('q', ''))
         suggestions = [result.code for result in sqs]