From 0ac0ca923687e1355ac3bc4217ba3c23eb42944a Mon Sep 17 00:00:00 2001
From: Sanj
Date: Tue, 30 Aug 2011 22:56:53 +0530
Subject: [PATCH] add list of features in authority record admin; cleaner urls
for json end-points
---
gazetteer/places/views.py | 14 ++++++++-
gazetteer/static/js/auth_record_admin.js | 30 +++++++++++++++++++
gazetteer/static/js/feature_admin.js | 2 +-
gazetteer/static/js/gazetteer.js | 2 +-
.../places/authorityrecord/change_form.html | 29 ++++++++++++++++++
gazetteer/urls.py | 5 ++--
6 files changed, 77 insertions(+), 5 deletions(-)
create mode 100644 gazetteer/static/js/auth_record_admin.js
diff --git a/gazetteer/places/views.py b/gazetteer/places/views.py
index 8b599e4..22331bf 100644
--- a/gazetteer/places/views.py
+++ b/gazetteer/places/views.py
@@ -61,4 +61,16 @@ def search_related_json(request):
'similarity': s.similarity,
'distance': s.distance
})
- return render_to_json_response(d)
+ return render_to_json_response(d)
+
+def auth_record_json(request):
+ id = request.GET.get("id", "0")
+ auth_record = get_object_or_404(AuthorityRecord, pk=id)
+ features = [f.get_geojson() for f in auth_record.feature_set.all()]
+ d = {
+ 'type': 'FeatureCollection',
+ 'features': features
+ }
+ return render_to_json_response(d)
+
+
diff --git a/gazetteer/static/js/auth_record_admin.js b/gazetteer/static/js/auth_record_admin.js
new file mode 100644
index 0000000..f4f09fd
--- /dev/null
+++ b/gazetteer/static/js/auth_record_admin.js
@@ -0,0 +1,30 @@
+$(function() {
+ $.getJSON("/auth_record_json", {
+ 'id': RECORD_ID
+ }, function(features) {
+ for (var i=0; i
Name | +Type | +County | +State | +