mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
added note support for recipe import
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
<div class="col-md-1">
|
||||
<input class="form-control" v-model="i.amount">
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-4">
|
||||
|
||||
<table class="table-layout:fixed">
|
||||
<col width="95%"/>
|
||||
@@ -119,7 +119,7 @@
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="col-md-4">
|
||||
|
||||
<multiselect v-tabindex
|
||||
ref="ingredient"
|
||||
@@ -143,6 +143,9 @@
|
||||
|
||||
</multiselect>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<input type="text" placeholder="{% trans 'Note' %}" class="form-control" v-model="i.note">
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<button class="btn btn-outline-danger btn-lg" type="button"
|
||||
@click="deleteIngredient(i)" tabindex="-1"><i
|
||||
|
||||
@@ -126,6 +126,7 @@ def import_url(request):
|
||||
else:
|
||||
u = Unit.objects.get(name=request.user.userpreference.default_unit)
|
||||
|
||||
# TODO properly handl no_amount recipes
|
||||
if isinstance(ing['amount'], str):
|
||||
try:
|
||||
ing['amount'] = float(ing['amount'].replace(',', '.'))
|
||||
@@ -133,7 +134,9 @@ def import_url(request):
|
||||
# TODO return proper error
|
||||
pass
|
||||
|
||||
step.ingredients.add(Ingredient.objects.create(food=f, unit=u, amount=ing['amount']))
|
||||
note = ing['note'] if 'note' in ing else ''
|
||||
|
||||
step.ingredients.add(Ingredient.objects.create(food=f, unit=u, amount=ing['amount'], note=note))
|
||||
|
||||
if data['image'] != '':
|
||||
response = requests.get(data['image'])
|
||||
|
||||
Reference in New Issue
Block a user