Division by zero fix

This commit is contained in:
reverend 2020-08-27 17:16:03 +02:00
parent c84be34a37
commit f34d70edd5

View File

@ -29,7 +29,7 @@ class Voucher(models.Model):
Creation date is being set automatically during voucher creation. Creation date is being set automatically during voucher creation.
""" """
code = models.CharField(unique=True, max_length=10) code = models.CharField(unique=True, max_length=30)
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
expires = models.DateField() expires = models.DateField()
@ -60,8 +60,8 @@ 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 = 0 longitude = 1
latitude = 0 latitude = 1
for place in place_list: for place in place_list:
longitude += place.longitude longitude += place.longitude