This commit is contained in:
Tyrel Souza 2015-09-01 00:50:22 -04:00
parent eb7e5c8943
commit b817aecd1e

View File

@ -13,6 +13,7 @@ class Track(models.Model):
def finish(self): def finish(self):
return self.segment_set.order_by("-time")[0].finish return self.segment_set.order_by("-time")[0].finish
class Segment(models.Model): class Segment(models.Model):
track = models.ForeignKey(Track) track = models.ForeignKey(Track)
time = models.DateTimeField() time = models.DateTimeField()
@ -22,11 +23,10 @@ class Segment(models.Model):
def finish(self): def finish(self):
return self.point_set.order_by("-time")[0].time return self.point_set.order_by("-time")[0].time
class Point(models.Model): class Point(models.Model):
time = models.DateTimeField() time = models.DateTimeField()
latitude = models.DecimalField(max_digits=13, decimal_places=10) latitude = models.DecimalField(max_digits=13, decimal_places=10)
longitude = models.DecimalField(max_digits=12, decimal_places=10) longitude = models.DecimalField(max_digits=12, decimal_places=10)
elevation = models.DecimalField(max_digits=20, decimal_places=2) elevation = models.DecimalField(max_digits=20, decimal_places=2)
segment = models.ForeignKey(Segment) segment = models.ForeignKey(Segment)