No realy
This commit is contained in:
parent
f34d70edd5
commit
55b8d16751
@ -60,14 +60,17 @@ class Place (models.Model):
|
|||||||
def average_latlon(place_list):
|
def average_latlon(place_list):
|
||||||
amount = len(place_list)
|
amount = len(place_list)
|
||||||
# Init fill values to prevent None
|
# Init fill values to prevent None
|
||||||
longitude = 1
|
longitude = 0
|
||||||
latitude = 1
|
latitude = 0
|
||||||
|
|
||||||
|
if amount > 0:
|
||||||
for place in place_list:
|
for place in place_list:
|
||||||
longitude += place.longitude
|
longitude += place.longitude
|
||||||
latitude += place.latitude
|
latitude += place.latitude
|
||||||
return (latitude / amount, longitude / amount)
|
return (latitude / amount, longitude / amount)
|
||||||
|
|
||||||
|
return (latitude, longitude)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user