Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Make sure the list shows the 'used' weekdays on new days too

Roland Geiderc3a271b95c1f
diff --git a/manager/views.py b/manager/views.py
index 6e860995c..d3811cbc1 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -708,9 +708,10 @@ def edit_day(request, id, day_id=None):
try:
if day.id != int(day_id):
used_days.append(weekday.id)
- # We didnt' get a valid integer as id (perhaps because this is a new day)
+ # We didnt' get a valid integer as id, probably because this is a new day,
+ # so add weekday to the list anyway
except ValueError:
- pass
+ used_days.append(weekday.id)
used_days.sort()
@@ -748,6 +749,7 @@ def edit_day(request, id, day_id=None):
# Set here the query set to filter out used days of the week
# (used in the sense that other training days on the same workout already have them set)
day_form.fields['day'].queryset=DaysOfWeek.objects.exclude(id__in=used_days)
+ logger.debug(day_form.fields['day'])
template_data['day_form'] = day_form