summaryrefslogtreecommitdiff
path: root/apps/locations/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'apps/locations/views.py')
-rw-r--r--apps/locations/views.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/apps/locations/views.py b/apps/locations/views.py
index a59a2e5..f360429 100644
--- a/apps/locations/views.py
+++ b/apps/locations/views.py
@@ -2,10 +2,24 @@ from django.shortcuts import render_to_response,get_object_or_404
from django.template import RequestContext
from blog.models import Entry
-from locations.models import Location, Country, Region
+from locations.models import Location, Country, Region, Route
def list_view(request):
- qs = Entry.objects.filter(status__exact=1)
- cl = Country.objects.filter(visited=True).exclude(name='default')
- rl = Region.objects.all()
- return render_to_response('archives/map.html', {'object_list': qs,'country_list':cl,'region_list':rl}, context_instance=RequestContext(request)) \ No newline at end of file
+ context = {
+ 'object_list' : Entry.objects.filter(status__exact=1),
+ 'country_list' : Country.objects.filter(visited=True).exclude(name='default'),
+ 'region_list' : Region.objects.all()
+ }
+ return render_to_response('archives/map.html', context, context_instance=RequestContext(request))
+
+from projects.shortcuts import render_to_geojson
+
+def data_json(request, id):
+ qs = Route.objects.filter(pk=id)
+ return render_to_geojson(
+ qs,
+ included_fields=['id',],
+ geom_attribute='geometry',
+ mimetype = 'application/json',
+ pretty_print=True
+ ) \ No newline at end of file