diff options
Diffstat (limited to 'apps/projects/views.py')
-rw-r--r-- | apps/projects/views.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/projects/views.py b/apps/projects/views.py index e3ed773..65de8ae 100644 --- a/apps/projects/views.py +++ b/apps/projects/views.py @@ -2,8 +2,10 @@ from django.shortcuts import render_to_response,get_object_or_404 from django.template import RequestContext from django.views.generic.list_detail import object_list from django.db.models import get_model +from django.http import HttpResponse +from django.core import serializers - +from projects.shortcuts import render_to_geojson from projects.models.base import Project from projects.models.fiveby import FiveBy from projects.models.natparks import NationalParks @@ -24,3 +26,13 @@ def detail(request,slug): return object_list(request, queryset=qs, template_name=template,) +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 + ) +
\ No newline at end of file |