summaryrefslogtreecommitdiff
path: root/app/locations/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/locations/views.py')
-rw-r--r--app/locations/views.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/locations/views.py b/app/locations/views.py
index 12901eb..c463eac 100644
--- a/app/locations/views.py
+++ b/app/locations/views.py
@@ -4,6 +4,9 @@ from jrnl.models import Entry
from locations.models import Country, Region, Route
from projects.shortcuts import render_to_geojson
+from django.views.generic import ListView
+from django.conf import settings
+
def map_list(request):
context = {
@@ -18,6 +21,40 @@ def map_list(request):
context_instance=RequestContext(request)
)
+class MapList(ListView):
+ """
+ Return list of Entries on map
+ """
+ context_object_name = 'object_list'
+ queryset = Entry.objects.filter(status__exact=1)
+ template_name = 'archives/map.html'
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(MapList, self).get_context_data(**kwargs)
+ context['country_list'] = Country.objects.filter(visited=True).exclude(name='default'),
+ context['route_list'] = Route.objects.all(),
+ context['region_list'] = Region.objects.all()
+ context['IMAGES_URL'] = settings.IMAGES_URL
+ return context
+
+
+class MapDataList(ListView):
+ """
+ Build data file for Entries on map
+ """
+ context_object_name = 'object_list'
+ queryset = Entry.objects.filter(status__exact=1)
+ template_name = 'archives/map_data.html'
+
+ def get_context_data(self, **kwargs):
+ # Call the base implementation first to get a context
+ context = super(MapDataList, self).get_context_data(**kwargs)
+ context['country_list'] = Country.objects.filter(visited=True).exclude(name='default'),
+ context['route_list'] = Route.objects.all(),
+ context['region_list'] = Region.objects.all()
+ context['IMAGES_URL'] = settings.IMAGES_URL
+ return context
def map_data(request):
context = {