mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
auto convert decimal seperator in ingredients
This commit is contained in:
@@ -52,7 +52,10 @@ def internal_recipe_update(request, pk):
|
||||
ingredient = RecipeIngredients()
|
||||
ingredient.recipe = recipe_instance
|
||||
ingredient.name = i['name']
|
||||
ingredient.amount = i['amount']
|
||||
if isinstance(i['amount'], str):
|
||||
ingredient.amount = float(i['amount'].replace(',', '.'))
|
||||
else:
|
||||
ingredient.amount = i['amount']
|
||||
ingredient.unit = i['unit']
|
||||
ingredient.save()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user