Self hosted FLOSS fitness/workout, nutrition and weight tracker
Remove unneeded code
Roland Geider734a35096109
diff --git a/wger/core/templates/index.html b/wger/core/templates/index.htmlindex ad1294098..f8cf80578 100644--- a/wger/core/templates/index.html+++ b/wger/core/templates/index.html@@ -115,9 +115,7 @@<div class="col-sm-6 col-md-4">- <div class="card h-100">- <div id="react-nutrition-dashboard"></div>- </div>+ <div id="react-nutrition-dashboard"></div></div>diff --git a/wger/core/tests/test_index.py b/wger/core/tests/test_index.pyindex 3c7f72f25..07192dbf5 100644--- a/wger/core/tests/test_index.py+++ b/wger/core/tests/test_index.py@@ -45,9 +45,7 @@ class DashboardTestCase(WgerTestCase):response = self.client.get(reverse('core:dashboard'))# There is something to send to the templateself.assertEqual(response.status_code, 200)- self.assertFalse(response.context['weight'])self.assertFalse(response.context['current_workout'])- self.assertFalse(response.context['plan'])## 1. Add a workout@@ -56,9 +54,7 @@ class DashboardTestCase(WgerTestCase):response = self.client.get(reverse('core:dashboard'))self.assertEqual(response.status_code, 200)- self.assertFalse(response.context['weight'])self.assertTrue(response.context['current_workout'])- self.assertFalse(response.context['plan'])self.assertTrue(response.context['weekdays'])#@@ -72,13 +68,12 @@ class DashboardTestCase(WgerTestCase):response = self.client.get(reverse('core:dashboard'))self.assertEqual(response.status_code, 200)- self.assertTrue(response.context['weight'])self.assertTrue(response.context['current_workout'])self.assertTrue(response.context['weekdays'])def test_dashboard_logged_in(self):"""- Test index page as a logged in user+ Test index page as a logged-in user"""self.user_login('admin')diff --git a/wger/core/views/misc.py b/wger/core/views/misc.pyindex 7dad28d50..cbf6325fe 100644--- a/wger/core/views/misc.py+++ b/wger/core/views/misc.py@@ -17,13 +17,16 @@# Standard Libraryimport logging+# Third Party+from crispy_forms.helper import FormHelper+from crispy_forms.layout import Submit+# Djangofrom django.conf import settingsfrom django.contrib import messagesfrom django.contrib.auth import login as django_loginfrom django.contrib.auth.decorators import login_requiredfrom django.core import mail-from django.core.exceptions import ObjectDoesNotExistfrom django.http import HttpResponseRedirectfrom django.shortcuts import renderfrom django.template.loader import render_to_string@@ -33,13 +36,8 @@ from django.urls import ()from django.utils.text import slugifyfrom django.utils.translation import gettext as _-from django.views.generic import TemplateViewfrom django.views.generic.edit import FormView-# Third Party-from crispy_forms.helper import FormHelper-from crispy_forms.layout import Submit-# wgerfrom wger.core.demo import (create_demo_entries,@@ -51,10 +49,6 @@ from wger.core.forms import ()from wger.core.models import DaysOfWeekfrom wger.manager.models import Schedule-from wger.nutrition.models import NutritionPlan-from wger.weight.helpers import get_last_entries-from wger.weight.models import WeightEntry-logger = logging.getLogger(__name__)@@ -121,21 +115,6 @@ def dashboard(request):context['current_workout'] = current_workoutcontext['schedule'] = schedule- # Load the last nutritional plan, if one exists- try:- plan = NutritionPlan.objects.filter(user=request.user).latest('creation_date')- except ObjectDoesNotExist:- plan = False- context['plan'] = plan-- # Load the last logged weight entry, if one exists- try:- weight = WeightEntry.objects.filter(user=request.user).latest('date')- except ObjectDoesNotExist:- weight = False- context['weight'] = weight- context['last_weight_entries'] = get_last_entries(request.user)-# Format a bit the days, so it doesn't have to be done in the templateused_days = {}if current_workout:@@ -156,10 +135,6 @@ def dashboard(request):context['weekdays'] = week_day_result- if plan:- # Load the nutritional info- context['nutritional_info'] = plan.get_nutritional_values()-return render(request, 'index.html', context)