Self hosted FLOSS fitness/workout, nutrition and weight tracker
Some more (test) fixes
Roland Geider54b4f299c406
diff --git a/wger/exercises/models/base.py b/wger/exercises/models/base.pyindex 9a4a652b9..c66e7de8c 100644--- a/wger/exercises/models/base.py+++ b/wger/exercises/models/base.py@@ -111,6 +111,13 @@ class ExerciseBase(AbstractLicenseModel, models.Model):# Own methods#+ @property+ def main_image(self):+ """+ Return the main image for the exercise or None if nothing is found+ """+ return self.exerciseimage_set.accepted().filter(is_main=True).first()+@propertydef get_languages(self) -> List[Language]:"""diff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.pyindex 502b246a1..8563f5743 100644--- a/wger/exercises/views/exercises.py+++ b/wger/exercises/views/exercises.py@@ -268,12 +268,12 @@ class ExercisesEditAddView(WgerFormMixin):return formdef form_valid(self, form):- exercise_base = ExerciseBase.objects.filter(id=form.instance.id)- exercise_base.equipment.set(form.cleaned_data['equipment'].all())- exercise_base.muscles.set(form.cleaned_data['muscles'].all())- exercise_base.muscles_secondary.set(form.cleaned_data['muscles_secondary'].all())+ base = ExerciseBase.objects.filter(id=form.instance.id)+ base.equipment.set(form.cleaned_data['equipment'].all())+ base.muscles.set(form.cleaned_data['muscles'].all())+ base.muscles_secondary.set(form.cleaned_data['muscles_secondary'].all())- form.instance.exercise_base = exercise_base+ form.instance.exercise_base = baseform.instance.save()return super(ExercisesEditAddView, self).form_valid(form)diff --git a/wger/manager/tests/test_ical.py b/wger/manager/tests/test_ical.pyindex 68a1f4c90..cb49f8266 100644--- a/wger/manager/tests/test_ical.py+++ b/wger/manager/tests/test_ical.py@@ -79,7 +79,7 @@ class WorkoutICalExportTestCase(WgerTestCase):# Approximate sizeself.assertGreater(len(response.content), 540)- self.assertLess(len(response.content), 560)+ self.assertLess(len(response.content), 620)def export_ical_token_wrong(self):"""@@ -116,7 +116,7 @@ class WorkoutICalExportTestCase(WgerTestCase):# Approximate sizeself.assertGreater(len(response.content), 540)- self.assertLess(len(response.content), 560)+ self.assertLess(len(response.content), 620)def test_export_ical_anonymous(self):"""@@ -176,7 +176,7 @@ class ScheduleICalExportTestCase(WgerTestCase):# Approximate sizeself.assertGreater(len(response.content), 1650)- self.assertLess(len(response.content), 1670)+ self.assertLess(len(response.content), 1800)def export_ical_token_wrong(self):"""@@ -213,7 +213,7 @@ class ScheduleICalExportTestCase(WgerTestCase):# Approximate sizeself.assertGreater(len(response.content), 1650)- self.assertLess(len(response.content), 1670)+ self.assertLess(len(response.content), 1800)def test_export_ical_anonymous(self):"""diff --git a/wger/manager/views/set.py b/wger/manager/views/set.pyindex 2957b2b76..790e2fafd 100644--- a/wger/manager/views/set.py+++ b/wger/manager/views/set.py@@ -196,7 +196,7 @@ def edit(request, pk):if request.method == "POST":formsets = []- for base in set_obj.exercises:+ for base in set_obj.exercise_bases:formset = SettingFormsetEdit(request.POST, prefix='exercise{0}'.format(base.id))formsets.append({'base': base, 'formset': formset})