2015-09-01 03:31:25 +00:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
# Create your models here.
|
|
|
|
|
|
|
|
|
|
|
|
class Track(models.Model):
|
|
|
|
start = models.DateTimeField()
|
|
|
|
name = models.CharField(max_length=1024, blank=False)
|
|
|
|
description = models.TextField(blank=True)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def finish(self):
|
|
|
|
return self.point_set.order_by("-time")[0].time
|
|
|
|
|
2015-09-01 03:56:40 +00:00
|
|
|
class Segment(models.Model):
|
|
|
|
track = models.ForeignKey(Track)
|
2015-09-01 03:31:25 +00:00
|
|
|
|
|
|
|
class Point(models.Model):
|
|
|
|
time = models.DateTimeField()
|
2015-09-01 03:56:40 +00:00
|
|
|
latitude = models.DecimalField(max_digits=13, decimal_places=10)
|
|
|
|
longitude = models.DecimalField(max_digits=12, decimal_places=10)
|
2015-09-01 03:31:25 +00:00
|
|
|
elevation = models.DecimalField(max_digits=20, decimal_places=2)
|
2015-09-01 03:56:40 +00:00
|
|
|
segment = models.ForeignKey(Segment)
|
2015-09-01 03:31:25 +00:00
|
|
|
|
|
|
|
|