From 21124ec2ade7898ed0e972f73d6eeed129b2b993 Mon Sep 17 00:00:00 2001 From: reverend Date: Sat, 12 Sep 2020 12:02:25 +0200 Subject: [PATCH] adapting list views --- .../templates/place/place_list.html | 70 +++++++++---------- .../lostplaces_app/views/place_views.py | 5 +- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/lostplaces/lostplaces_app/templates/place/place_list.html b/lostplaces/lostplaces_app/templates/place/place_list.html index 455779c..f0bcae8 100644 --- a/lostplaces/lostplaces_app/templates/place/place_list.html +++ b/lostplaces/lostplaces_app/templates/place/place_list.html @@ -2,57 +2,57 @@ {% load static %} {% block additional_head %} - - + + {% endblock additional_head %} {% block title %}Lost Places{% endblock %} {% block maincontent %} -{% include 'partials/osm_map.html' %} +{% include 'partials/osm_map.html' with config=map_config %}

Listing our places

- + {% include 'partials/nav/pagination.html' %}
diff --git a/lostplaces/lostplaces_app/views/place_views.py b/lostplaces/lostplaces_app/views/place_views.py index 9f8d8b9..505de0a 100644 --- a/lostplaces/lostplaces_app/views/place_views.py +++ b/lostplaces/lostplaces_app/views/place_views.py @@ -23,7 +23,10 @@ class PlaceListView(IsAuthenticated, ListView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - context['place_map_center'] = Place.average_latlon(context['place_list']) + context['map_config'] = { + 'point_list': context['place_list'], + 'map_center': Place.average_latlon(context['place_list']) + } return context class PlaceDetailView(IsAuthenticated, View):