24 lines
561 B
Python
24 lines
561 B
Python
|
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
|
||
|
|
||
|
|
||
|
class Point(models.Model):
|
||
|
time = models.DateTimeField()
|
||
|
latitude = models.FloatField()
|
||
|
longitude = models.FloatField()
|
||
|
elevation = models.DecimalField(max_digits=20, decimal_places=2)
|
||
|
track = models.ForeignKey(Track)
|
||
|
|
||
|
|