From 25980fccaf5b1f3ea4db5ddc5f3d59ce935e7632 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Mon, 30 Dec 2024 22:40:25 +0100 Subject: [PATCH] Also reset the exercise api cache when deleting images --- wger/exercises/models/image.py | 2 ++ wger/utils/cache.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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 @@ def delete(self, *args, **kwargs): """ 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):