# HG changeset patch # User cavaliet # Date 1409673325 -7200 # Node ID fc89613986096114451d981cd9e4ec7fa9754bb4 # Parent d58ab6429d5ab575d743574e3932087ad24c7cb4 enhance uri for notices and tags diff -r d58ab6429d5a -r fc8961398609 src/hdalab/views/ajax.py --- a/src/hdalab/views/ajax.py Tue Sep 02 15:13:42 2014 +0200 +++ b/src/hdalab/views/ajax.py Tue Sep 02 17:55:25 2014 +0200 @@ -374,7 +374,12 @@ for ts in qs: if hasattr(ts, 'tag') and hasattr(ts.tag, 'dbpedia_fields') : match_tag = ts.tag.id in matchtagids - contenus[ts.datasheet_id]['tags'].append({'id': ts.tag.id, 'label':ts.tag.label, 'order':ts.order, 'match': match_tag , 'translated_label': translations.get(ts.tag.dbpedia_fields.id, ts.tag.label) if ts.tag.dbpedia_fields is not None else ts.tag.label}) + contenus[ts.datasheet_id]['tags'].append({'id': ts.tag.id, + 'label': ts.tag.label, + 'order': ts.order, + 'match': match_tag, + 'translated_label': translations.get(ts.tag.dbpedia_fields.id, ts.tag.label) if ts.tag.dbpedia_fields is not None else ts.tag.label, + 'url': ts.tag.dbpedia_uri}) if match_tag: contenus[ts.datasheet_id]['score'] += 2*max_tag_order - ts.order @@ -401,7 +406,12 @@ transqs = DbpediaFieldsTranslation.objects.filter(master__in = dbpediafields.values(), language_code = lang) translations = dict([(trans.master_id,trans.label) for trans in transqs]) - tags = [{'id': tag.id, 'label': tag.label, 'score': tag.nb, 'thumbnail': dbpediafields[tag.id].thumbnail, 'translated_label': translations.get(dbpediafields[tag.id].id, tag.label) if tag.id in dbpediafields else tag.label} for tag in tagqslist] + tags = [{'id': tag.id, + 'label': tag.label, + 'score': tag.nb, + 'thumbnail': dbpediafields[tag.id].thumbnail, + 'translated_label': translations.get(dbpediafields[tag.id].id, tag.label) if tag.id in dbpediafields else tag.label, + 'url': tag.dbpedia_uri} for tag in tagqslist] countryqs = countryqs.annotate(nb=Count('includes__tag__taggedsheet')) countries = dict([(country.dbpedia_uri, country.nb) for country in countryqs]) diff -r d58ab6429d5a -r fc8961398609 src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Tue Sep 02 15:13:42 2014 +0200 +++ b/src/hdalab/views/profile.py Tue Sep 02 17:55:25 2014 +0200 @@ -164,7 +164,7 @@ "description": notice.description, "uri": notice.url, "position": np.get_place("datasheet"), - "image": static("hdalab/img/page_icon.png"), + "image": "http://www.histoiredesarts.culture.fr/images/pf/" + notice.hda_id + ".jpg", "size": 0, "project_id": project_id, "color": None, @@ -187,7 +187,7 @@ "id": unicode(uuid.uuid1()), "title": translations.get(t.dbpedia_fields.id, t.label) if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields else t.label, "description": t.dbpedia_uri, - "uri": t.dbpedia_uri, + "uri": "", "position": np.get_place("tags"), "image": img_url, "size": 0, @@ -239,7 +239,7 @@ "description": n.description, "uri": n.url, "position": np.get_place("datasheet"), - "image": static("hdalab/img/page_icon.png"), + "image": "http://www.histoiredesarts.culture.fr/images/pf/" + n.hda_id + ".jpg", "size": 0, "project_id": project_id, "color": None, @@ -254,7 +254,7 @@ content["nodes"].append({ "id": tag_uuid_dict[t.pk], "title": translations.get(t.dbpedia_fields.id, t.label) if hasattr(t, 'dbpedia_fields') and t.dbpedia_fields else t.label, - "description": t.dbpedia_uri, + "description": "", "uri": t.dbpedia_uri, "position": np.get_place("tags"), "image": img_url, @@ -315,7 +315,7 @@ for tt in filter_output["tags"]: if tt["label"]==t["label"]: thumbnail_url = tt["thumbnail"] - related_tags.append({"label": t["label"], "thumbnail":thumbnail_url, "id":t["id"]}) + related_tags.append({"label": t["label"], "thumbnail":thumbnail_url, "id":t["id"], "url":t["url"]}) all_labels.append(t["label"]) related_tags_dict[c["id"]].append(t["id"]) @@ -367,7 +367,7 @@ "description": c["description"], "uri": c["url"], "position": np.get_place("datasheet"), - "image": None, + "image": "http://www.histoiredesarts.culture.fr/images/pf/" + c["hda_id"]+ ".jpg", "size": 0, "project_id": project_id, "color": "#FF0033", @@ -379,7 +379,7 @@ "id": t["id"], "title": filter_output["tagtranslations"][t["label"]], "description": "", - "uri": "", + "uri": t["url"], "position": np.get_place("related"), "image": t["thumbnail"], "size": 0,