mirror of
https://github.com/wger-project/wger.git
synced 2026-02-18 00:17:51 +01:00
Correctly access the value of the ingredient source enum
This commit is contained in:
@@ -150,7 +150,7 @@ for product in db.products.find({'lang': {"$in": list(languages.keys())}, 'compl
|
||||
if common_name and len(common_name) > 200:
|
||||
continue
|
||||
|
||||
source_name = Source.OPEN_FOOD_FACTS
|
||||
source_name = Source.OPEN_FOOD_FACTS.value
|
||||
source_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 products
|
||||
|
||||
@@ -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:
|
||||
return
|
||||
|
||||
if not settings.WGER_SETTINGS['DOWNLOAD_FROM_OFF']:
|
||||
|
||||
Reference in New Issue
Block a user