Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Also reset the exercise api cache when deleting images

Roland Geider25980fccaf5b
diff --git a/wger/exercises/models/image.py b/wger/exercises/models/image.py
index 28c0653b5..289fd198a 100644
--- a/wger/exercises/models/image.py
+++ b/wger/exercises/models/image.py
@@ -158,6 +158,8 @@ class ExerciseImage(AbstractLicenseModel, AbstractHistoryMixin, models.Model, Ba
"""
Reset all cached infos
"""
+ reset_exercise_api_cache(self.exercise_base.uuid)
+
super().delete(*args, **kwargs)
# Make sure there is always a main image
diff --git a/wger/utils/cache.py b/wger/utils/cache.py
index a83fabb07..3abd578b6 100644
--- a/wger/utils/cache.py
+++ b/wger/utils/cache.py
@@ -36,7 +36,7 @@ def reset_workout_canonical_form(workout_id):
def reset_exercise_api_cache(uuid: str):
- cache.delete(cache_mapper.get_exercise_api_key(uuid))
+ cache.delete(CacheKeyMapper.get_exercise_api_key(uuid))
def reset_workout_log(user_pk, year, month, day=None):