From d01d27e959f865658755197f7f71fbedad4cc9c3 Mon Sep 17 00:00:00 2001 From: Eric Mc Sween Date: Thu, 28 Oct 2010 15:50:25 -0400 Subject: [PATCH] =?utf8?q?Recherche=20par=20mots-cl=C3=A9s=20dans=20les=20di?= =?utf8?q?sciplines=20et=20r=C3=A9gions=20des=20ressources.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- auf_savoirs_en_partage/savoirs/models.py | 4 +++- .../templates/savoirs/ressource_resultat.html | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/auf_savoirs_en_partage/savoirs/models.py b/auf_savoirs_en_partage/savoirs/models.py index 4e4c7cb..4b85fa9 100644 --- a/auf_savoirs_en_partage/savoirs/models.py +++ b/auf_savoirs_en_partage/savoirs/models.py @@ -243,7 +243,9 @@ class RecordQuerySet(models.query.QuerySet): for word in words: qs = qs.filter(Q(title__icontains=word) | Q(description__icontains=word) | Q(creator__icontains=word) | Q(contributor__icontains=word) | - Q(subject__icontains=word)) + Q(subject__icontains=word) | Q(disciplines__nom__icontains=word) | + Q(regions__nom__icontains=word) | Q(pays__nom__icontains=word) | + Q(pays__region__nom__icontains=word)) # On donne un point pour chaque mot présent dans le titre. score_expr = ' + '.join(['(title LIKE %s)'] * len(words)) diff --git a/auf_savoirs_en_partage/templates/savoirs/ressource_resultat.html b/auf_savoirs_en_partage/templates/savoirs/ressource_resultat.html index 669310d..f54800f 100644 --- a/auf_savoirs_en_partage/templates/savoirs/ressource_resultat.html +++ b/auf_savoirs_en_partage/templates/savoirs/ressource_resultat.html @@ -1,11 +1,11 @@ {% load search %}
- {{ ressource.title|highlight:search_regexp }} - {% if ressource.creator %} -
Auteur: {{ ressource.creator|highlight:search_regexp }}
- {% endif %} - {% if ressource.description %} -
Description: {{ ressource.description|excerpt:search_regexp|highlight:search_regexp }}
- {% endif %} + {{ ressource.title|highlight:search_regexp }} + {% if ressource.creator %} +
Auteur: {{ ressource.creator|highlight:search_regexp }}
+ {% endif %} + {% if ressource.description %} +
Description: {{ ressource.description|excerpt:search_regexp|highlight:search_regexp }}
+ {% endif %}
-- 1.7.10.4