Made the center of the map consider only shown places (dynamic).

This commit is contained in:
Marcus Scholz 2020-08-21 10:31:30 +02:00
parent 65f3642272
commit 03af8a0c02
2 changed files with 2 additions and 3 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

@ -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