workout histo & workout delete - urls.py 225
This commit is contained in:
@@ -15,7 +15,7 @@ from django.contrib.auth.models import User
|
||||
|
||||
|
||||
@app.task
|
||||
def addcomment2(userid,id):
|
||||
def addcomment2(userid,id,debug=False):
|
||||
|
||||
time.sleep(5)
|
||||
# w = Workout.objects.get(id=id)
|
||||
|
||||
@@ -30,5 +30,5 @@
|
||||
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_workouts.html' %}
|
||||
{% include 'menu_workout.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -5,63 +5,74 @@
|
||||
<label for="group-workout">Workout</label>
|
||||
<ul>
|
||||
<li id="workout-dashboard">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/workflow">
|
||||
<i class="fas fa-tachometer-alt fa-fw"></i> View
|
||||
</a>
|
||||
</li>
|
||||
<li id="workout-edit">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/edit">
|
||||
<i class="fas fa-pencil-alt fa-fw"></i> Edit
|
||||
</a>
|
||||
</li>
|
||||
<li id="workout-intervals">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/editintervals">
|
||||
<i class="fas fa-pause fa-fw"></i> Intervals
|
||||
</a>
|
||||
</li>
|
||||
<li id="workout-stats">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/stats">
|
||||
<i class="fal fa-table fa-fw"></i> Statistics
|
||||
</a>
|
||||
</li>
|
||||
<li id="compare">
|
||||
<a href="#0">
|
||||
<a href="/rowers/multi-compare">
|
||||
<i class="fas fa-balance-scale fa-fw"></i> Compare
|
||||
</a>
|
||||
</li>
|
||||
<li id="workout-delete">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/delete">
|
||||
<i class="fas fa-trash-alt fa-fw"></i> Delete
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-children" id="flexchart">
|
||||
<input type="checkbox" name="group-flexchart" id="group-flexchart">
|
||||
<label for="group-flexchart">Interactive Charts</label>
|
||||
<ul>
|
||||
<li id="chart-flexchart">
|
||||
<a href="/rowers/workout/{{ workout.id }}/flexchart">
|
||||
<i class="fas fa-chart-line fa-fw"></i> Flex Chart
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-children" id="chart">
|
||||
<input type="checkbox" name="group-chart" id="group-chart">
|
||||
<label for="group-chart">Charts</label>
|
||||
<label for="group-chart">Static Charts</label>
|
||||
<ul>
|
||||
<li id="chart-time">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/addtimeplot">
|
||||
<i class="fas fa-stopwatch fa-fw"></i> Time
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-distance">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/adddistanceplot">
|
||||
<i class="fas fa-ruler fa-fw"></i> Distance
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-powerpie">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/addpowerpiechart">
|
||||
<i class="far fa-chart-pie fa-fw"></i> Power (Pie)
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-hrpie">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/addpiechart">
|
||||
<i class="fas fa-heartbeat fa-fw"></i> Heart Rate (Pie)
|
||||
</a>
|
||||
</li>
|
||||
<li id="chart-otwpower">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/addotwpowerplot">
|
||||
<i class="fas fa-chart-area fa-fw"></i> OTW Power
|
||||
</a>
|
||||
</li>
|
||||
@@ -71,15 +82,15 @@
|
||||
<input type="checkbox" name="group-export" id="group-export">
|
||||
<label for="group-export">Export</label>
|
||||
<ul>
|
||||
<li id="export-c2"><a href="">Concept2</a></li>
|
||||
<li id="export-strava"><a href="">Strava</a></li>
|
||||
<li id="export-st"><a href="">SportTracks</a></li>
|
||||
<li id="export-rk"><a href="">Runkeeper</a></li>
|
||||
<li id="export-mmf"><a href="">MapMyFitness</a></li>
|
||||
<li id="export-tp"><a href="">TrainingPeaks</a></li>
|
||||
<li id="export-csv"><a href="">CSV</a></li>
|
||||
<li id="export-gpx"><a href="">GPX</a></li>
|
||||
<li id="export-tcx"><a href="">TCX</a></li>
|
||||
<li id="export-c2"><a href="/rowers/workout/{{ workout.id }}/c2uploadw">Concept2</a></li>
|
||||
<li id="export-strava"><a href="/rowers/workout/{{ workout.id }}/stravauploadw">Strava</a></li>
|
||||
<li id="export-st"><a href="/rowers/workout/{{ workout.id }}/sporttracksuploadw">SportTracks</a></li>
|
||||
<li id="export-rk"><a href="/rowers/workout/{{ workout.id }}/runkeeperuploadw">Runkeeper</a></li>
|
||||
<li id="export-mmf"><a href="/rowers/workout/{{ workout.id }}/underarmouruploadw">MapMyFitness</a></li>
|
||||
<li id="export-tp"><a href="/rowers/workout/{{ workout.id }}/tpuploadw">TrainingPeaks</a></li>
|
||||
<li id="export-csv"><a href="/rowers/workout/{{ workout.id }}/emailcsv">CSV</a></li>
|
||||
<li id="export-gpx"><a href="/rowers/workout/{{ workout.id }}/emailgpx">GPX</a></li>
|
||||
<li id="export-tcx"><a href="/rowers/workout/{{ workout.id }}/emailtcx">TCX</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="has-children" id="data">
|
||||
@@ -87,22 +98,22 @@
|
||||
<label for="group-data">Data</label>
|
||||
<ul>
|
||||
<li id="data-smoothen">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/smoothenpace">
|
||||
<i class="fas fa-magic fa-fw"></i> Smoothen
|
||||
</a>
|
||||
</li>
|
||||
<li id="data-raw">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/undosmoothenpace">
|
||||
<i class="fas fa-undo fa-fw"></i> Restore Raw
|
||||
</a>
|
||||
</li>
|
||||
<li id="data-fusion">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/fusion/{{ workout.id }}/">
|
||||
<i class="fas fa-blender fa-fw"></i> Sensor Fusion
|
||||
</a>
|
||||
</li>
|
||||
<li id="data-split">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/split">
|
||||
<i class="fas fa-cut fa-fw"></i> Split Workout
|
||||
</a>
|
||||
</li>
|
||||
@@ -113,22 +124,22 @@
|
||||
<label for="group-advanced">Advanced</label>
|
||||
<ul>
|
||||
<li id="advanced-wind">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/wind">
|
||||
<i class="fas fa-pennant fa-fw"></i> Wind
|
||||
</a>
|
||||
</li>
|
||||
<li id="advanced-stream">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/stream">
|
||||
<i class="fas fa-stream fa-fw"></i> Stream
|
||||
</a>
|
||||
</li>
|
||||
<li id="advanced-otwpower">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/otwsetpower">
|
||||
<i class="fas fa-calculator-alt fa-fw"></i> OTW Power
|
||||
</a>
|
||||
</li>
|
||||
<li id="advanced-instroke">
|
||||
<a href="">
|
||||
<a href="/rowers/workout/{{ workout.id }}/instroke">
|
||||
<i class="fas fa-search-plus fa-fw"></i> In-Stroke Metrics</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -1,51 +1,41 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "newbase.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block title %}Change Workout {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="workouts" class="grid_6 alpha">
|
||||
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
Please correct the error{{ form.errors|pluralize }} below.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<h1>Confirm Workout Delete</h1>
|
||||
This will delete the following workout and all linked graph images:
|
||||
|
||||
<table width=100%>
|
||||
<tr>
|
||||
{% block main %}
|
||||
<h1>Delete {{ workout }}?</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
<p>
|
||||
This will delete the following workout and all related data (charts, comments):
|
||||
</p>
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<th>Name:</th><td>{{ workout.name }}</td>
|
||||
</tr><tr>
|
||||
<th>Date:</th><td>{{ workout.date }}</td>
|
||||
</tr><tr>
|
||||
</tr><tr>
|
||||
<th>Time:</th><td>{{ workout.starttime }}</td>
|
||||
</tr><tr>
|
||||
</tr><tr>
|
||||
<th>Distance:</th><td>{{ workout.distance }}m</td>
|
||||
</tr><tr>
|
||||
</tr><tr>
|
||||
<th>Duration:</th><td>{{ workout.duration |durationprint:"%H:%M:%S.%f" }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="grid_2 alpha">
|
||||
<p>
|
||||
<a class="button green small" href="/rowers/list-workouts/">Cancel</a>
|
||||
</div>
|
||||
|
||||
<div class="grid_2">
|
||||
<p>
|
||||
<a class="button red small" href="/rowers/workout/{{ workout.id }}/delete">Delete</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="images" class="grid_6 omega">
|
||||
<p>
|
||||
|
||||
</b>
|
||||
</div>
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
<input class="button red" type="submit" value="Confirm">
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_workout.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -321,7 +321,7 @@ urlpatterns = [
|
||||
url(r'^workout/(?P<id>\d+)/addstatic/(?P<plotnr>\d+)$',
|
||||
views.workout_add_chart_view),
|
||||
url(r'^workout/(?P<id>\d+)/addstatic$',views.workout_add_chart_view),
|
||||
url(r'^workout/(?P<id>\d+)/delete$',views.workout_delete_view),
|
||||
url(r'^workout/(?P<pk>\d+)/delete$',views.WorkoutDelete.as_view(),name='workout_delete'),
|
||||
url(r'^workout/(?P<id>\d+)/smoothenpace$',views.workout_smoothenpace_view),
|
||||
url(r'^workout/(?P<id>\d+)/undosmoothenpace$',views.workout_undo_smoothenpace_view),
|
||||
url(r'^workout/c2import/$',views.workout_c2import_view),
|
||||
@@ -338,7 +338,7 @@ urlpatterns = [
|
||||
url(r'^workout/polarimport/$',views.workout_polarimport_view),
|
||||
url(r'^workout/runkeeperimport/$',views.workout_runkeeperimport_view),
|
||||
url(r'^workout/underarmourimport/$',views.workout_underarmourimport_view),
|
||||
url(r'^workout/(?P<id>\d+)/deleteconfirm$',views.workout_delete_confirm_view),
|
||||
# url(r'^workout/(?P<id>\d+)/deleteconfirm$',views.workout_delete_confirm_view),
|
||||
url(r'^workout/(?P<id>\d+)/c2uploadw/$',views.workout_c2_upload_view),
|
||||
url(r'^workout/(?P<id>\d+)/stravauploadw/$',views.workout_strava_upload_view),
|
||||
url(r'^workout/(?P<id>\d+)/recalcsummary/$',views.workout_recalcsummary_view),
|
||||
|
||||
@@ -2897,6 +2897,7 @@ def workout_histo_view(request,id=0):
|
||||
{'interactiveplot':script,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'active':'nav-workouts',
|
||||
'workout':w,
|
||||
'rower':r,
|
||||
'the_div':div,
|
||||
'id':int(id),
|
||||
@@ -14514,6 +14515,48 @@ class GraphDelete(DeleteView):
|
||||
|
||||
return obj
|
||||
|
||||
class WorkoutDelete(DeleteView):
|
||||
login_required = True
|
||||
model = Workout
|
||||
template_name = 'workout_delete_confirm.html'
|
||||
|
||||
# extra parameters
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(WorkoutDelete, self).get_context_data(**kwargs)
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/list-workouts',
|
||||
'name':'Workouts'
|
||||
},
|
||||
{
|
||||
'url':get_workout_default_page(self.request,self.object.id),
|
||||
'name': str(self.object.id)
|
||||
},
|
||||
{ 'url':reverse('workout_delete',kwargs={'pk':str(self.object.pk)}),
|
||||
'name': 'Delete'
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
context['active'] = 'nav-workouts'
|
||||
context['rower'] = getrower(self.request.user)
|
||||
context['breadcrumbs'] = breadcrumbs
|
||||
context['workout'] = self.object
|
||||
|
||||
return context
|
||||
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse(workouts_view)
|
||||
|
||||
def get_object(self, *args, **kwargs):
|
||||
obj = super(WorkoutDelete, self).get_object(*args, **kwargs)
|
||||
if not checkaccessuser(self.request.user,obj.user):
|
||||
raise PermissionDenied('You are not allowed to delete this workout')
|
||||
|
||||
return obj
|
||||
|
||||
class MacroCycleDelete(DeleteView):
|
||||
model = TrainingMacroCycle
|
||||
template_name = 'trainingplan_delete.html'
|
||||
|
||||
Reference in New Issue
Block a user