Self hosted FLOSS fitness/workout, nutrition and weight tracker
Rework the information presented for workouts
Roland Geider0658329e0ce4
diff --git a/manager/templates/index.html b/manager/templates/index.htmlindex c96164a8f..68041fbfe 100644--- a/manager/templates/index.html+++ b/manager/templates/index.html@@ -12,21 +12,32 @@<div class="ym-grid linearize-level-1"><div class="ym-g50 ym-gl"><div class="ym-gbox-left">- <h2>{% trans "Your workouts"%}</h2>- {% if latest_workouts_list %}- <ul>- {% for workout in latest_workouts_list %}- <li><a href="{% url manager.views.view_workout workout.id %}">- {% if workout.comment %}- {{ workout.comment }}- {% else %}- {% trans "Workout" %}+ <h2>{% trans "Current workout"%}</h2>+ {% if current_workout %}+ <a href="{% url manager.views.view_workout current_workout.id %}">+ {% if current_workout.comment %}+ {{ current_workout.comment }}+ {% else %}+ {% trans "Workout" %}+ {% endif %}+ </a>+ – {{ current_workout.creation_date }}+++ <ul>+ {% for i in weekdays %}+ <li>+ {{ i }}:++ {% for day in current_workout.day_set.select_related %}+ {% if day.day == forloop.parentloop.counter %}+ {{ day.description }}{% endif %}- </a>- <br> – {{ workout.creation_date }}- </li>+ {% endfor %}+ </li>{% endfor %}- </ul>+ </ul>+{% else %}<div class="box warning">{% trans "No workouts found." %} {% trans "Use link to add one." %}diff --git a/manager/templates/workout/overview.html b/manager/templates/workout/overview.htmlindex 73e275a4d..86ef80c6c 100644--- a/manager/templates/workout/overview.html+++ b/manager/templates/workout/overview.html@@ -2,6 +2,7 @@{% load i18n %}{% load staticfiles %}+{% block title %}{% trans "Your workouts" %}{% endblock %}diff --git a/manager/views.py b/manager/views.pyindex 07de5fe3d..bb7f68bb1 100644--- a/manager/views.py+++ b/manager/views.py@@ -64,14 +64,26 @@ class UserPreferencesForm(ModelForm):@login_requireddef index(request):- """Show the index page, in our case, a list of workouts+ """Show the index page, in our case, the last workout and nutriotion plan+ and the current weight"""template_data = {}template_data['active_tab'] = 'user'++ weekdays = (_('Monday'),+ _('Tuesday'),+ _('Wednesday'),+ _('Thursday'),+ _('Friday'),+ _('Saturday'),+ _('Sunday'),+ )++ template_data['weekdays'] = weekdays- latest_trainings = TrainingSchedule.objects.filter(user=request.user).order_by('-creation_date')[:5]- template_data['latest_workouts_list'] = latest_trainings+ current_workout = TrainingSchedule.objects.filter(user=request.user).latest('creation_date')+ template_data['current_workout'] = current_workoutplans = NutritionPlan.objects.filter(user = request.user)template_data['plans'] = plans