diff options
Diffstat (limited to 'app/locations/models.py')
-rw-r--r-- | app/locations/models.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/locations/models.py b/app/locations/models.py index e9eb047..6f598b2 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -469,6 +469,7 @@ def parse_gpx(gpx_obj, gpx_data): class Walk(models.Model): title = models.CharField(max_length=300) + subtitle = models.CharField(max_length=200, blank=True) slug = models.SlugField() body_markdown = models.TextField() body_html = models.TextField(blank=True) @@ -484,11 +485,19 @@ class Walk(models.Model): ('5', "5 Stars"), ) rating = models.CharField(max_length=1, choices=RATINGS, null=True, blank=True) - distance = models.DecimalField(max_digits=3, decimal_places=1, null=True) + distance = models.DecimalField(max_digits=3, decimal_places=2, null=True) + duration = models.DecimalField(max_digits=3, decimal_places=0, null=True, help_text="in minutes") def __str_(self): return self.title + def get_rating(self): + return int(self.rating) + + @property + def ratings_range(cls): + return range(1, 6) + def save(self, *args, **kwargs): created = self.pk is None if not created: |