From 8491edfcf760cd6f7287790b40944b81ccfa2080 Mon Sep 17 00:00:00 2001
From: Sanj
Date: Thu, 1 Sep 2011 03:36:16 +0530
Subject: [PATCH] show features in time-frame admin
---
gazetteer/places/views.py | 10 +++++-
gazetteer/static/js/auth_record_admin.js | 2 +-
gazetteer/static/js/gazetteer.js | 4 +--
gazetteer/static/js/time_frame_admin.js | 30 +++++++++++++++++
.../admin/places/timeframe/change_form.html | 33 +++++++++++++++++++
gazetteer/urls.py | 1 +
6 files changed, 76 insertions(+), 4 deletions(-)
create mode 100644 gazetteer/static/js/time_frame_admin.js
create mode 100644 gazetteer/templates/admin/places/timeframe/change_form.html
diff --git a/gazetteer/places/views.py b/gazetteer/places/views.py
index bc46b1d..847c817 100644
--- a/gazetteer/places/views.py
+++ b/gazetteer/places/views.py
@@ -106,7 +106,7 @@ def search_related_json(request, id):
def auth_record_json(request):
id = request.GET.get("id", "0")
- auth_record = get_object_or_404(AuthorityRecord, pk=id)
+ auth_record = get_object_or_404_json(AuthorityRecord, pk=id)
features = [f.get_geojson() for f in auth_record.feature_set.all()]
d = {
'type': 'FeatureCollection',
@@ -114,4 +114,12 @@ def auth_record_json(request):
}
return render_to_json_response(d)
+def time_frame_json(request):
+ time_frame = get_object_or_404_json(AuthorityRecord, pk=id)
+ features = [f.get_geojson() for f in time_frame.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
index 22ae0ac..f7eab7b 100644
--- a/gazetteer/static/js/auth_record_admin.js
+++ b/gazetteer/static/js/auth_record_admin.js
@@ -1,5 +1,5 @@
$(function() {
- $.getJSON("/auth_record_json", {
+ $.getJSON("/auth_record.json", {
'id': RECORD_ID
}, function(features) {
for (var i=0; i
Name | +URI | +Type | +County | +State | +
---|