mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -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 = RecipeIngredients()
|
||||||
ingredient.recipe = recipe_instance
|
ingredient.recipe = recipe_instance
|
||||||
ingredient.name = i['name']
|
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.unit = i['unit']
|
||||||
ingredient.save()
|
ingredient.save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user