Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Properly set the image data retrieved from the API

Roland Geider7a870a5e7056
diff --git a/wger/nutrition/models/image.py b/wger/nutrition/models/image.py
index b83e68c6e..5cbf5b7f8 100644
--- a/wger/nutrition/models/image.py
+++ b/wger/nutrition/models/image.py
@@ -84,7 +84,11 @@ class Image(AbstractLicenseModel, models.Model, BaseImage):
image.ingredient = connect_to
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.size = json_data['size']
image.save_image(retrieved_image, json_data)
diff --git a/wger/nutrition/sync.py b/wger/nutrition/sync.py
index 86b37fb84..dacbb2125 100644
--- a/wger/nutrition/sync.py
+++ b/wger/nutrition/sync.py
@@ -132,6 +132,7 @@ def fetch_image_from_off(ingredient):
'license_author': uploader_name,
'license_author_url': uploader_url,
'license_object_url': url,
+ 'license_derivative_source_url': '',
'size': len(response.content)
}
try: