Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Always create a new exercise base

Roland Geideracda42af5b68
diff --git a/wger/exercises/views/exercises.py b/wger/exercises/views/exercises.py
index 0046b81e9..5cb724f0a 100644
--- a/wger/exercises/views/exercises.py
+++ b/wger/exercises/views/exercises.py
@@ -329,8 +329,17 @@ class ExerciseAddView(ExercisesEditAddView, LoginRequiredMixin, CreateView):
for elem in form.cleaned_data['muscles_secondary'].all():
existing = existing.filter(muscles_secondary=elem)
- # Create a new exercise base
- if not existing:
+ # ---> Temporary solution to avoid duplicate entries
+ #
+ # When creating several related exercises, it is possible that they all
+ # share a base. This will cause problems when e.g. adding images, since
+ # they get saved to the base and not the exercise translation. In this case,
+ # deleting an image causes another error. This logic will be handled better
+ # with the new react app anyway.
+ #
+ # Always create a new exercise base
+ # if not existing:
+ if True:
exercise_base = ExerciseBase.objects.create(
category=form.cleaned_data['category'],
license=form.cleaned_data['license'],