Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add helper to return the translated days of the week for a workout day

Roland Geider9a51d0078be9
diff --git a/wger/core/templates/tags/render_day.html b/wger/core/templates/tags/render_day.html
index 1d27ca142..9de0e5c70 100644
--- a/wger/core/templates/tags/render_day.html
+++ b/wger/core/templates/tags/render_day.html
@@ -51,7 +51,7 @@
{% endif %}
<h4>{{ day.description }}</h4>
- {{ day.days_of_week.text }}
+ {{ day.days_txt }}
</th>
</tr>
</thead>
diff --git a/wger/manager/helpers.py b/wger/manager/helpers.py
index f77e74f9b..cbf5527d1 100644
--- a/wger/manager/helpers.py
+++ b/wger/manager/helpers.py
@@ -76,7 +76,7 @@ def render_workout_day(day, nr_of_weeks=7, images=False, comments=False, only_ta
p = Paragraph(
'<para align="center">%(days)s: %(description)s</para>' % {
- 'days': ', '.join([str(_(i.day_of_week)) for i in day.day.all()]),
+ 'days': day.days_txt,
'description': day.description
}, styleSheet["SubHeader"]
)
diff --git a/wger/manager/models/day.py b/wger/manager/models/day.py
index 3a349c239..dba8bb29d 100644
--- a/wger/manager/models/day.py
+++ b/wger/manager/models/day.py
@@ -55,6 +55,10 @@ class Day(models.Model):
"""
return self.training
+ @property
+ def days_txt(self):
+ return ', '.join([str(_(i.day_of_week)) for i in self.day.all()])
+
@property
def get_first_day_id(self):
"""