Compare commits

..

5 Commits

8 changed files with 10 additions and 6 deletions

View File

@ -57,8 +57,7 @@ class Place (models.Model):
# Get center position of all LP-geocoordinates. # Get center position of all LP-geocoordinates.
def average_latlon(): def average_latlon(place_list):
place_list = Place.objects.all()
amount = len(place_list) amount = len(place_list)
longitude = 0 longitude = 0
latitude = 0 latitude = 0

View File

@ -0,0 +1,6 @@
# Keeping these files up-to-date is something for CI / release management.
# But for now I noted the source urls down here for later reference.
https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/css/ol.css
https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/build/ol.js
https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.3.1/build/ol.js.map

View File

@ -1,8 +1,8 @@
{% extends 'global.html'%} {% extends 'global.html'%}
{% load static %} {% load static %}
{% block additional_head %} {% block additional_head %}
<link rel="stylesheet" href="{% static 'ol.css' %}" type="text/css"> <link rel="stylesheet" href="{% static 'maps/ol.css' %}" type="text/css">
<script src="{% static 'ol.js' %}"></script> <script src="{% static 'maps/ol.js' %}"></script>
{% endblock additional_head %} {% endblock additional_head %}
# {% block title %}Start{% endblock %} # {% block title %}Start{% endblock %}

View File

@ -1,4 +1,3 @@
{% load static %}
<div id="map" class="map"></div> <div id="map" class="map"></div>
<div id="info" class="map-popup"></div> <div id="info" class="map-popup"></div>

View File

@ -64,7 +64,7 @@ class PlaceDetailView(IsAuthenticated, View):
class HomeView(View): class HomeView(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
place_list = Place.objects.all().order_by('-submitted_when')[:10] place_list = Place.objects.all().order_by('-submitted_when')[:10]
place_map_center = Place.average_latlon() place_map_center = Place.average_latlon(place_list)
context = { context = {
'place_list': place_list, 'place_list': place_list,
'place_map_center': place_map_center 'place_map_center': place_map_center