diff options
Diffstat (limited to 'app/locations')
-rw-r--r-- | app/locations/build.py | 12 | ||||
-rw-r--r-- | app/locations/views.py | 14 |
2 files changed, 19 insertions, 7 deletions
diff --git a/app/locations/build.py b/app/locations/build.py new file mode 100644 index 0000000..cf17c59 --- /dev/null +++ b/app/locations/build.py @@ -0,0 +1,12 @@ + + def build_map(self): + self.build_list_view( + base_path=reverse("map:maplist"), + paginate_by=1000000 + ) + response = self.client.get(reverse("map:mapdata")) + self.write_file("media/js/mainmap", response.content, 'js', '') + +def map_builder(): + j = BuildJrnl("jrnl", "entry") + j.build_map() diff --git a/app/locations/views.py b/app/locations/views.py index bf6cd84..e5d580b 100644 --- a/app/locations/views.py +++ b/app/locations/views.py @@ -5,7 +5,7 @@ from django.views.generic.detail import DetailView from django.conf import settings from django.db.models import Q -from jrnl.models import Entry +from posts.models import Post #from projects.shortcuts import render_to_geojson from sightings.models import Sighting from utils.views import PaginatedListView @@ -13,7 +13,7 @@ from .models import Country, Region, Route, Location, Track def map_list(request): context = { - 'object_list': Entry.objects.filter(status__exact=1), + 'object_list': Post.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() @@ -29,7 +29,7 @@ class MapList(ListView): Return list of Entries on map """ context_object_name = 'object_list' - queryset = Entry.objects.filter(status__exact=1) + queryset = Post.objects.filter(status__exact=1) template_name = 'archives/map.html' def get_context_data(self, **kwargs): @@ -47,7 +47,7 @@ class MapDataList(ListView): Build data file for Entries on map """ context_object_name = 'object_list' - queryset = Entry.objects.filter(status__exact=1) + queryset = Post.objects.filter(status__exact=1) template_name = 'archives/map_data.html' def get_context_data(self, **kwargs): @@ -61,7 +61,7 @@ class MapDataList(ListView): def map_data(request): context = { - 'object_list': Entry.objects.filter(status__exact=1), + 'object_list': Post.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() @@ -90,7 +90,7 @@ class LocationDetail(DetailView): def get_context_data(self, **kwargs): context = super(LocationDetail, self).get_context_data(**kwargs) - context['entry_list'] = Entry.objects.filter( + context['entry_list'] = Post.objects.filter( Q(location=self.get_object()) | Q(location__in=Location.objects.filter(parent=self.get_object())) ) @@ -106,7 +106,7 @@ class TrackDetail(DetailView): def get_context_data(self, **kwargs): context = super(WalkDetail, self).get_context_data(**kwargs) - context['entry_list'] = Entry.objects.filter( + context['entry_list'] = Post.objects.filter( Q(location=self.get_object().location) | Q(location__in=Location.objects.filter(parent=self.get_object().location)) ) |