From 60ac6d466f63a3d5bef27a53e5992586a78cbd53 Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 29 Aug 2011 18:43:22 +0530 Subject: [PATCH] return similar features correctly --- gazetteer/places/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gazetteer/places/views.py b/gazetteer/places/views.py index 728330a..a3e1d8f 100644 --- a/gazetteer/places/views.py +++ b/gazetteer/places/views.py @@ -30,11 +30,19 @@ def search_related(request): id = request.GET.get("id", "0") feature = get_object_or_404(Feature, pk=id) similar_features = feature.similar_features() + d = [] for s in similar_features: - s['feature_type'] = FeatureType.objects.get(pk=s.feature_type_id) + d.append({ + 'id': s.id, + 'feature_type': FeatureType.objects.get(pk=s.feature_type_id) + 'preferred_name': s.preferred_name, + 'similarity': s.similarity, + 'distance': s.distance + }) + return render_to_response("search_related.html", { 'feature': feature, - 'similar_features': similar_features + 'similar_features': d })