diff options
Diffstat (limited to 'app/locations/views.py')
-rw-r--r-- | app/locations/views.py | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/app/locations/views.py b/app/locations/views.py index 234d867..5ae1ef9 100644 --- a/app/locations/views.py +++ b/app/locations/views.py @@ -1,35 +1,44 @@ -from django.shortcuts import render_to_response,get_object_or_404 +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, Route +from projects.shortcuts import render_to_geojson + def map_list(request): context = { - 'object_list' : Entry.objects.filter(status__exact=1), - 'country_list' : Country.objects.filter(visited=True).exclude(name='default'), - 'route_list' : Route.objects.all(), - 'region_list' : Region.objects.all() + 'object_list': Entry.objects.filter(status__exact=1), + 'country_list': Country.objects.filter(visited=True).exclude(name='default'), + 'route_list': Route.objects.all(), + 'region_list': Region.objects.all() } - return render_to_response('archives/map.html', context, context_instance=RequestContext(request)) + return render_to_response( + 'archives/map.html', + context, + context_instance=RequestContext(request) + ) + def map_data(request): context = { - 'object_list' : Entry.objects.filter(status__exact=1), - 'route_list' : Route.objects.all(), - 'country_list' : Country.objects.filter(visited=True).exclude(name='default'), - 'region_list' : Region.objects.all() + 'object_list': Entry.objects.filter(status__exact=1), + 'route_list': Route.objects.all(), + 'country_list': Country.objects.filter(visited=True).exclude(name='default'), + 'region_list': Region.objects.all() } - return render_to_response('archives/map_data.html', context, context_instance=RequestContext(request)) - -from projects.shortcuts import render_to_geojson + return render_to_response( + 'archives/map_data.html', + context, + context_instance=RequestContext(request) + ) + def data_json(request, id): qs = Route.objects.filter(pk=id) return render_to_geojson( qs, - included_fields=['id',], + included_fields=['id', ], geom_attribute='geometry', - mimetype = 'application/json', + mimetype='application/json', pretty_print=True - ) + ) |