Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Separate the check to see if the objects belong to the same tree

Roland Geiderb5c7013c42ec
diff --git a/manager/views.py b/manager/views.py
index d40ce72e3..d17a54770 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -404,13 +404,17 @@ def edit_set(request, id, day_id, set_id=None):
workout_set = Set()
else:
workout_set = get_object_or_404(Set, pk=set_id)
+
+ # Check if all objects belong to the workout
+ if workout_set.exerciseday.id != day.id:
+ return HttpResponseForbidden()
template_data['set'] = workout_set
-
# Check if all objects belong to the workout
- if day.training.id != workout.id or workout_set.exerciseday.id != day.id:
+ if day.training.id != workout.id:
return HttpResponseForbidden()
+
# Process request
if request.method == 'POST':
set_form = SetForm(request.POST, instance=workout_set)
@@ -529,8 +533,6 @@ def api_edit_set(request):
# new settings: are called 'new-setting-UUID1, new-setting-UUID2, etc.'
for i in request.POST:
order_counter += 1
- #logger.debug(request.POST)
-
# old settings, update
if i.startswith('setting'):