return similar features correctly

This commit is contained in:
Sanj 2011-08-29 18:43:22 +05:30
parent 3a2c3852f4
commit 60ac6d466f

View File

@ -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
})