From f4bb714ddef5e4dcc8a3945d6463eaf039d516ed Mon Sep 17 00:00:00 2001
From: Sanj
Date: Mon, 29 Aug 2011 18:22:10 +0530
Subject: [PATCH] start view similar page
---
gazetteer/places/views.py | 11 ++++++++---
gazetteer/static/css/main.css | 4 ++++
gazetteer/static/js/gazetteer.js | 1 +
gazetteer/templates/search_related.html | 11 +++++++++++
gazetteer/urls.py | 4 ++--
5 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/gazetteer/places/views.py b/gazetteer/places/views.py
index 894ba03..f991976 100644
--- a/gazetteer/places/views.py
+++ b/gazetteer/places/views.py
@@ -1,6 +1,6 @@
# Create your views here.
from django.shortcuts import render_to_response
-from ox.django.shortcuts import render_to_json_response
+from ox.django.shortcuts import render_to_json_response, get_object_or_404
from django.template import RequestContext
from models import Feature
@@ -27,8 +27,13 @@ def search_json(request):
def search_related(request):
- d = RequestContext(request, {})
- return render_to_response("search_related.html")
+ id = request.GET.get("id", "0")
+ feature = get_object_or_404(Feature, pk=id)
+ similar_features = feature.similar_features()
+ return render_to_response("search_related.html", {
+ 'feature': feature,
+ 'similar_features': similar_features
+ })
def search_related_json(request):
diff --git a/gazetteer/static/css/main.css b/gazetteer/static/css/main.css
index a41fb4b..480a8f8 100644
--- a/gazetteer/static/css/main.css
+++ b/gazetteer/static/css/main.css
@@ -175,3 +175,7 @@ height:8.6%; /*HA HA HA HA HA HA HA DECIMALS should work, right*/
/*margin:0 auto;*/
background-color:grey;
clear:both;}
+
+#mapList thead {
+ font-weight:bold;
+}
diff --git a/gazetteer/static/js/gazetteer.js b/gazetteer/static/js/gazetteer.js
index 4273b45..2bae7cb 100644
--- a/gazetteer/static/js/gazetteer.js
+++ b/gazetteer/static/js/gazetteer.js
@@ -40,6 +40,7 @@ function getRow(props) {
var $tr = $('');
var $one = $('