diff options
Diffstat (limited to 'app/locations')
-rw-r--r-- | app/locations/urls.py | 5 | ||||
-rw-r--r-- | app/locations/views.py | 14 |
2 files changed, 15 insertions, 4 deletions
diff --git a/app/locations/urls.py b/app/locations/urls.py index c49e684..0a2a462 100644 --- a/app/locations/urls.py +++ b/app/locations/urls.py @@ -1,7 +1,8 @@ + from django.conf.urls.defaults import * -from django.views.generic.simple import redirect_to,direct_to_template urlpatterns = patterns('', (r'data/(?P<id>\d+)/$', 'locations.views.data_json'), - (r'^$', direct_to_template, {'template': 'archives/map.html'}), + (r'^$', 'locations.views.map_list'), ) + diff --git a/app/locations/views.py b/app/locations/views.py index f360429..234d867 100644 --- a/app/locations/views.py +++ b/app/locations/views.py @@ -4,13 +4,23 @@ from django.template import RequestContext from blog.models import Entry from locations.models import Location, Country, Region, Route -def list_view(request): +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() } 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() + } + return render_to_response('archives/map_data.html', context, context_instance=RequestContext(request)) from projects.shortcuts import render_to_geojson @@ -22,4 +32,4 @@ def data_json(request, id): geom_attribute='geometry', mimetype = 'application/json', pretty_print=True - )
\ No newline at end of file + ) |