summaryrefslogtreecommitdiff
path: root/app/projects/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/projects/views.py')
-rw-r--r--app/projects/views.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/projects/views.py b/app/projects/views.py
index c8a0692..39ae781 100644
--- a/app/projects/views.py
+++ b/app/projects/views.py
@@ -2,6 +2,8 @@ from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.db.models import get_model
+from projects.shortcuts import render_to_geojson
+from projects.models.natparks import NationalParks
from projects.models.gifs import AnimatedGif
projects = {
@@ -30,3 +32,14 @@ def detail(request, slug):
def gif_detail(request, slug):
obj = get_object_or_404(AnimatedGif, slug__exact=slug)
return render_to_response('details/gifs.html', {'object': obj}, context_instance=RequestContext(request))
+
+
+def data_json(request, id):
+ qs = NationalParks.objects.filter(pk=id)
+ return render_to_geojson(
+ qs,
+ included_fields=['id'],
+ geom_attribute='mpoly',
+ mimetype='application/json',
+ pretty_print=True
+ )