v0.32 : exact equivalent management : 0018322 and 0018230.
--- a/src/core/models/__init__.py Fri Dec 06 14:38:20 2013 +0100
+++ b/src/core/models/__init__.py Fri Dec 06 15:37:43 2013 +0100
@@ -2,7 +2,8 @@
'AutrNoticeTerm', 'DomnNoticeTerm', 'EcolNoticeTerm',
'EpoqNoticeTerm', 'LieuxNoticeTerm', 'PeriNoticeTerm',
'ReprNoticeTerm', 'SrepNoticeTerm',
- 'TERM_URL_STATUS_CHOICES', 'TERM_URL_STATUS_CHOICES_TRANS', 'TERM_URL_STATUS_DICT', 'TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS',
+ 'TERM_URL_STATUS_CHOICES', 'TERM_URL_STATUS_CHOICES_TRANS', 'TERM_URL_STATUS_DICT',
+ 'TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS', 'TERM_WK_LINK_SEMANTIC_LEVEL_DICT'
]
from core.models.user import User
@@ -11,4 +12,4 @@
ReprNoticeTerm, SrepNoticeTerm)
from core.models.term import (Term, TermLabel, Thesaurus, TERM_URL_STATUS_CHOICES,
TERM_URL_STATUS_CHOICES_TRANS, TERM_URL_STATUS_DICT,
- TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS)
+ TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES_TRANS, TERM_WK_LINK_SEMANTIC_LEVEL_DICT)
--- a/src/jocondelab/__init__.py Fri Dec 06 14:38:20 2013 +0100
+++ b/src/jocondelab/__init__.py Fri Dec 06 15:37:43 2013 +0100
@@ -1,4 +1,4 @@
-VERSION = (0, 31, 0, "final", 0)
+VERSION = (0, 32, 0, "final", 0)
def get_version():
--- a/src/jocondelab/views/front_office.py Fri Dec 06 14:38:20 2013 +0100
+++ b/src/jocondelab/views/front_office.py Fri Dec 06 15:37:43 2013 +0100
@@ -5,7 +5,7 @@
@author: rvelt
'''
-from core.models import Notice, Term
+from core.models import Notice, Term, TERM_WK_LINK_SEMANTIC_LEVEL_DICT
from django.conf import settings
from django.core.cache import cache
from django.core.paginator import Paginator
@@ -26,7 +26,7 @@
termsbythesaurus = {}
for n in notices:
termsbythesaurus[n.pk] = {}
- for nt in Term.objects.select_related('thesaurus__label','notices__pk').filter(noticeterm__notice__in=notices, dbpedia_fields=None).order_by('label').distinct().values("thesaurus__label", "dbpedia_uri", "label", "notices__pk"):
+ for nt in Term.objects.select_related('thesaurus__label','notices__pk').filter(noticeterm__notice__in=notices, dbpedia_fields=None, link_semantic_level=TERM_WK_LINK_SEMANTIC_LEVEL_DICT["EE"]).order_by('label').distinct().values("thesaurus__label", "dbpedia_uri", "label", "notices__pk"):
term = {
"thesaurus": nt["thesaurus__label"],
"dbpedia_uri": nt["dbpedia_uri"],
@@ -36,7 +36,7 @@
th = termsbythesaurus[nt["notices__pk"]].setdefault(term["thesaurus"], { "translated": [], "untranslated": [] })
th["untranslated"].append(term)
# We use "values" because it avoids an other db request for dbpedia_fields.get(language_code = lang).label
- for nt in Term.objects.select_related('thesaurus__label','dbpedia_fields','notices__pk').filter(noticeterm__notice__in=notices, dbpedia_fields__language_code=lang).order_by('dbpedia_fields__label').distinct().values("thesaurus__label", "dbpedia_uri", "dbpedia_fields__label", "notices__pk"):
+ for nt in Term.objects.select_related('thesaurus__label','dbpedia_fields','notices__pk').filter(noticeterm__notice__in=notices, dbpedia_fields__language_code=lang, link_semantic_level=TERM_WK_LINK_SEMANTIC_LEVEL_DICT["EE"]).order_by('dbpedia_fields__label').distinct().values("thesaurus__label", "dbpedia_uri", "dbpedia_fields__label", "notices__pk"):
term = {
"thesaurus": nt["thesaurus__label"],
"dbpedia_uri": nt["dbpedia_uri"],
@@ -142,6 +142,8 @@
queryobj = {'from_year': from_year, 'to_year': to_year}
searchterms = [u"%s – %s"%(from_year, to_year)]
qs = qs.filter(years__start_year__lte=to_year, years__end_year__gte=from_year, noticeterm__term__validated=True)
+ # add general filter : only exact equivalence terms :
+ qs = qs.filter(noticeterm__term__link_semantic_level=TERM_WK_LINK_SEMANTIC_LEVEL_DICT["EE"])
context["queryobj"] = json.dumps(queryobj)
context["querystr"] = urlencode(queryobj)
context["searchterms_label"] = ugettext(u" ET ").join(searchterms)