Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Only check that the day belongs to a workout if the day was loaded from DB

Roland Geider29d142d55350
diff --git a/manager/views.py b/manager/views.py
index 5b45966fc..aff4130a2 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -304,12 +304,12 @@ def edit_day(request, id, day_id=None):
day = Day()
else:
day = get_object_or_404(Day, pk=day_id)
+
+ # Check that the day belongs to the workout
+ if day.training.id != workout.id:
+ return HttpResponseForbidden()
template_data['day'] = day
- # Check that the day belongs to the workout
- if day.training.id != workout.id:
- return HttpResponseForbidden()
-
# Process request
if request.method == 'POST':
day_form = DayForm(request.POST, instance=day)