Self hosted FLOSS fitness/workout, nutrition and weight tracker
Correctly access the value of the ingredient source enum
Roland Geiderefb471e3500b
diff --git a/extras/scripts/create_ingredients_from_foodfacts.py b/extras/scripts/create_ingredients_from_foodfacts.pyindex ef053267a..fc5b0477d 100644--- a/extras/scripts/create_ingredients_from_foodfacts.py+++ b/extras/scripts/create_ingredients_from_foodfacts.py@@ -150,7 +150,7 @@ for product in db.products.find({'lang': {"$in": list(languages.keys())}, 'complif common_name and len(common_name) > 200:continue- source_name = Source.OPEN_FOOD_FACTS+ source_name = Source.OPEN_FOOD_FACTS.valuesource_url = f'https://world.openfoodfacts.org/api/v0/product/{code}.json'ingredient_data = {@@ -171,7 +171,7 @@ for product in db.products.find({'lang': {"$in": list(languages.keys())}, 'compl'brand': brand,'status': 2,'license_id': 5,- 'license_author': Source.OPEN_FOOD_FACTS,+ 'license_author': Source.OPEN_FOOD_FACTS.value,}# Add entries as new productsdiff --git a/wger/nutrition/models/ingredient.py b/wger/nutrition/models/ingredient.pyindex ab39f9137..a1a658df8 100644--- a/wger/nutrition/models/ingredient.py+++ b/wger/nutrition/models/ingredient.py@@ -460,7 +460,7 @@ class Ingredient(AbstractSubmissionModel, AbstractLicenseModel, models.Model):if not request.user.is_authenticated:return- if self.source_name != Source.OPEN_FOOD_FACTS:+ if self.source_name != Source.OPEN_FOOD_FACTS.value:returnif not settings.WGER_SETTINGS['DOWNLOAD_FROM_OFF']: