Self hosted FLOSS fitness/workout, nutrition and weight tracker
Simplify exercise_overview
Roland Geiderd38b20b72c47
diff --git a/manager/templates/exercise/overview.html b/manager/templates/exercise/overview.htmlindex c05ad2059..27b605e0d 100644--- a/manager/templates/exercise/overview.html+++ b/manager/templates/exercise/overview.html@@ -21,20 +21,20 @@</p><table>-{% for category_id, category_data in exercises.items %}+{% for category in categories %}<tr><th>- {{ category_data.category.name }} <!--(ID {{ category_id }})-->+ {{ category.name }} <!--(ID {{ category.id}})--></th><td style="text-align: right;">- <a href="/exercise/category/delete/{{ category_id}}"+ <a href="/exercise/category/delete/{{ category.id }}"title="{% trans "Delete" %}">[x]</a>- <a href="/exercise/category/edit/{{ category_id }}"+ <a href="/exercise/category/edit/{{ category.id }}"title="{% trans "Edit" %}">[e]</a></td></tr>- {% for exercise in category_data.exercises %}+ {% for exercise in category.exercise_set.all %}<tr><td colspan="2"><a href="/exercise/view/{{ exercise.id }}">{{ exercise.name }}</a>diff --git a/manager/views.py b/manager/views.pyindex 067ea1382..262aa5275 100644--- a/manager/views.py+++ b/manager/views.py@@ -217,17 +217,7 @@ def exercise_overview(request):"""template_data = {}- ex_data = {}-- # Gather all exercises and group them by category- for i in Exercise.objects.all().order_by('category'):- if not ex_data.get(i.category.id):- ex_data[i.category.id] = {'category': i.category, 'exercises': []}-- ex_data[i.category.id]['exercises'].append(i)-- template_data['exercises'] = ex_data- logger.debug(template_data)+ template_data['categories'] = ExerciseCategory.objects.all()return render_to_response('exercise/overview.html', template_data)