Made the center of the map consider only shown places (dynamic).
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user