diff options
author | luxagraf <sng@luxagraf.net> | 2020-03-08 11:52:38 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-03-08 11:52:38 -0400 |
commit | b8551e606d7c1c8b405fc1e8b115db8b81db75eb (patch) | |
tree | 1f941f53e54066aec27fbb326ec1ae2e2e7236f3 | |
parent | 46806df781a8e23bd75e916005aaba49ef009adb (diff) |
renamed walk to track for genericness
-rw-r--r-- | app/locations/admin.py | 6 | ||||
-rw-r--r-- | app/locations/models.py | 8 | ||||
-rw-r--r-- | app/locations/urls.py | 4 | ||||
-rw-r--r-- | app/locations/views.py | 10 | ||||
-rw-r--r-- | app/locations/walk_urls.py | 12 |
5 files changed, 23 insertions, 17 deletions
diff --git a/app/locations/admin.py b/app/locations/admin.py index df65894..b428e0d 100644 --- a/app/locations/admin.py +++ b/app/locations/admin.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin -from .models import Region, Country, Location, State, Route, LuxCheckIn, Campsite, GPXFile, GPXTrack, Walk +from .models import Region, Country, Location, State, Route, LuxCheckIn, Campsite, GPXFile, GPXTrack, Track from utils.widgets import OLAdminBase from utils.util import get_latlon @@ -289,8 +289,8 @@ class GPXTrackAdmin(OLAdminBase): pass -@admin.register(Walk) -class WalkAdmin(OLAdminBase): +@admin.register(Track) +class TrackAdmin(OLAdminBase): form = LGEntryForm list_display = ('title', 'date_walked', 'distance', 'rating', 'location') list_filter = ('rating', 'location', 'date_walked') diff --git a/app/locations/models.py b/app/locations/models.py index e0409eb..dfd8f27 100644 --- a/app/locations/models.py +++ b/app/locations/models.py @@ -416,6 +416,7 @@ class GPXPoint(models.Model): def __str__(self): return str(self.name) + class GPXTrack(models.Model): track = models.MultiLineStringField() gpx_file = models.ForeignKey(GPXFile, on_delete=models.CASCADE) @@ -464,7 +465,7 @@ def parse_gpx(gpx_obj, gpx_data): new_track.save() -class Walk(models.Model): +class Track(models.Model): title = models.CharField(max_length=300) subtitle = models.CharField(max_length=200, blank=True) slug = models.SlugField() @@ -482,6 +483,11 @@ class Walk(models.Model): ('5', "5 Stars"), ) rating = models.CharField(max_length=1, choices=RATINGS, null=True, blank=True) + PACE = ( + ('1', "Walk"), + ('2', "Run"), + ) + pace = models.CharField(max_length=1, choices=PACE, default=2) 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") diff --git a/app/locations/urls.py b/app/locations/urls.py index ee98b17..c0ec4c4 100644 --- a/app/locations/urls.py +++ b/app/locations/urls.py @@ -7,8 +7,8 @@ app_name = "locations" urlpatterns = [ path( r'<str:slug>', - views.WalkDetail.as_view(), - name="walk-detail" + views.TrackDetail.as_view(), + name="track-detail" ), path( r'<str:country>/<str:state>/<str:slug>/', diff --git a/app/locations/views.py b/app/locations/views.py index 48ecc07..a6d9ea1 100644 --- a/app/locations/views.py +++ b/app/locations/views.py @@ -9,7 +9,7 @@ from jrnl.models import Entry from projects.shortcuts import render_to_geojson from sightings.models import Sighting from utils.views import PaginatedListView -from .models import Country, Region, Route, Location, Walk +from .models import Country, Region, Route, Location, Track def map_list(request): context = { @@ -101,8 +101,8 @@ class LocationDetail(DetailView): return context -class WalkDetail(DetailView): - model = Walk +class TrackDetail(DetailView): + model = Track def get_context_data(self, **kwargs): context = super(WalkDetail, self).get_context_data(**kwargs) @@ -116,8 +116,8 @@ class WalkDetail(DetailView): ).order_by('ap_id', 'ap__apclass__kind').distinct("ap") return context -class WalkList(PaginatedListView): +class TrackList(PaginatedListView): """ Return list of Walks """ - model = Walk + model = Track diff --git a/app/locations/walk_urls.py b/app/locations/walk_urls.py index 4019ef6..f3ed6cc 100644 --- a/app/locations/walk_urls.py +++ b/app/locations/walk_urls.py @@ -7,18 +7,18 @@ app_name = "walks" urlpatterns = [ path( r'<str:slug>', - views.WalkDetail.as_view(), - name="walk-detail" + views.TrackDetail.as_view(), + name="track-detail" ), re_path( r'^(?P<page>\d+)/$', - views.WalkList.as_view(), - name="walk-list" + views.TrackList.as_view(), + name="track-list" ), re_path( r'', - views.WalkList.as_view(), + views.TrackList.as_view(), {'page':1}, - name="walk-list" + name="track-list" ), ] |