Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Use also the user-ID when loading TrainingSchedules

Roland Geider7b6b809b9093
diff --git a/manager/views.py b/manager/views.py
index e4721f2b7..56db8b1d6 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -113,7 +113,7 @@ def view_workout(request, id):
"""
template_data = {}
- workout = get_object_or_404(TrainingSchedule, pk=id)
+ workout = get_object_or_404(TrainingSchedule, pk=id, user=request.user)
template_data['workout'] = workout
return render_to_response('workout/view.html',
@@ -130,7 +130,7 @@ def pdf_workout(request, id):
"""
#Load the workout
- workout = get_object_or_404(TrainingSchedule, pk=id)
+ workout = get_object_or_404(TrainingSchedule, pk=id, user=request.user)
# Create the HttpResponse object with the appropriate PDF headers.
response = HttpResponse(mimetype='application/pdf')
@@ -254,7 +254,7 @@ def delete_workout(request, id):
"""
# Load the workout
- workout = get_object_or_404(TrainingSchedule, pk=id)
+ workout = get_object_or_404(TrainingSchedule, pk=id, user=request.user)
workout.delete()
return HttpResponseRedirect('/')