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.
def average_latlon():
place_list = Place.objects.all()
def average_latlon(place_list):
amount = len(place_list)
longitude = 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'%}
{% load static %}
{% block additional_head %}
<link rel="stylesheet" href="{% static 'ol.css' %}" type="text/css">
<script src="{% static 'ol.js' %}"></script>
<link rel="stylesheet" href="{% static 'maps/ol.css' %}" type="text/css">
<script src="{% static 'maps/ol.js' %}"></script>
{% endblock additional_head %}
# {% block title %}Start{% endblock %}

View File

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

View File

@ -64,7 +64,7 @@ class PlaceDetailView(IsAuthenticated, View):
class HomeView(View):
def get(self, request, *args, **kwargs):
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 = {
'place_list': place_list,
'place_map_center': place_map_center