Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Use a constant to display the days of the week

Roland Geider3648f179feec
diff --git a/manager/templates/index.html b/manager/templates/index.html
index 68041fbfe..08c664a66 100644
--- a/manager/templates/index.html
+++ b/manager/templates/index.html
@@ -25,12 +25,12 @@
<ul>
- {% for i in weekdays %}
+ {% for i, j in weekdays %}
<li>
- {{ i }}:
+ {{ j }}:
{% for day in current_workout.day_set.select_related %}
- {% if day.day == forloop.parentloop.counter %}
+ {% if day.day == i %}
{{ day.description }}
{% endif %}
{% endfor %}
diff --git a/manager/views.py b/manager/views.py
index bb7f68bb1..01d82a333 100644
--- a/manager/views.py
+++ b/manager/views.py
@@ -34,6 +34,7 @@ from django.contrib.auth.models import User as Django_User
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import UserCreationForm
+from manager.models import DAYS_OF_WEEK_CHOICES
from manager.models import TrainingSchedule
from manager.models import Day
from manager.models import Set
@@ -71,16 +72,7 @@ def index(request):
template_data = {}
template_data['active_tab'] = 'user'
- weekdays = (_('Monday'),
- _('Tuesday'),
- _('Wednesday'),
- _('Thursday'),
- _('Friday'),
- _('Saturday'),
- _('Sunday'),
- )
-
- template_data['weekdays'] = weekdays
+ template_data['weekdays'] = DAYS_OF_WEEK_CHOICES
current_workout = TrainingSchedule.objects.filter(user=request.user).latest('creation_date')
template_data['current_workout'] = current_workout