Self hosted FLOSS fitness/workout, nutrition and weight tracker
Correctly load exercise bases by UUID and generate corresponding image
Roland Geider69ac31672fc2
diff --git a/wger/exercises/models/image.py b/wger/exercises/models/image.pyindex 6cc726dd9..d31d2548a 100644--- a/wger/exercises/models/image.py+++ b/wger/exercises/models/image.py@@ -175,6 +175,13 @@ class ExerciseImage(AbstractLicenseModel, AbstractHistoryMixin, models.Model, Baimage.exercise_base = connect_toimage.is_main = json_data['is_main']+ image.license_id = json_data['license']+ image.license_title = json_data['license_title']+ image.license_object_url = json_data['license_object_url']+ image.license_author = json_data['license_author']+ image.license_author_url = json_data['license_author_url']+ image.license_derivative_source_url = json_data['license_derivative_source_url']+image.save_image(retrieved_image, json_data)image.save()diff --git a/wger/exercises/sync.py b/wger/exercises/sync.pyindex b40629834..a54a29962 100644--- a/wger/exercises/sync.py+++ b/wger/exercises/sync.py@@ -355,7 +355,7 @@ def download_exercise_images(print_fn(f'Processing image {image_uuid}')try:- exercise_base = ExerciseBase.objects.get(id=image_data['exercise_base'])+ exercise_base = ExerciseBase.objects.get(uuid=image_data['exercise_base_uuid'])except ExerciseBase.DoesNotExist:print_fn(' Remote exercise base not found in local DB, skipping...')continue@@ -370,8 +370,7 @@ def download_exercise_images(image = ExerciseImage.from_json(exercise_base,retrieved_image,- image_data,- headers,+ image_data)# Temporary files on Windows don't support the delete attribute@@ -383,7 +382,6 @@ def download_exercise_images(img_temp.flush()image.exercise_base = exercise_base- image.is_main = image_data['is_main']image.image.save(os.path.basename(os.path.basename(image_data['image'])),File(img_temp),