summaryrefslogtreecommitdiff
path: root/app/locations
diff options
context:
space:
mode:
Diffstat (limited to 'app/locations')
-rw-r--r--app/locations/urls.py9
-rw-r--r--app/locations/views.py37
2 files changed, 45 insertions, 1 deletions
diff --git a/app/locations/urls.py b/app/locations/urls.py
index 77f9f0c..72a88de 100644
--- a/app/locations/urls.py
+++ b/app/locations/urls.py
@@ -2,7 +2,14 @@ from django.conf.urls import url
from . import views
+app_name = "locations"
+
urlpatterns = [
url(r'data/(?P<id>\d+)/$', views.data_json),
- url(r'^$', views.map_list),
+ url(
+ r'^$',
+ views.MapList.as_view(),
+ name="maplist"
+ ),
+ #url(r'^$', views.map_list),
]
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 = {