diff --git a/cookbook/forms.py b/cookbook/forms.py
index 6ec059cba..2f2bb8755 100644
--- a/cookbook/forms.py
+++ b/cookbook/forms.py
@@ -73,11 +73,16 @@ class InternalRecipeForm(forms.ModelForm):
widgets = {'keywords': MultiSelectWidget}
-class RecipeForm(forms.Form):
+class ShoppingForm(forms.Form):
recipe = forms.ModelMultipleChoiceField(
queryset=Recipe.objects.all(),
widget=MultiSelectWidget
)
+ markdown_format = forms.BooleanField(
+ help_text=_('Include - [ ] in list for easier usage in markdown based documents.'),
+ required=False,
+ initial=True
+ )
class UnitMergeForm(forms.Form):
diff --git a/cookbook/templates/shopping_list.html b/cookbook/templates/shopping_list.html
index 4943b1915..638f32227 100644
--- a/cookbook/templates/shopping_list.html
+++ b/cookbook/templates/shopping_list.html
@@ -26,7 +26,7 @@
diff --git a/cookbook/views/views.py b/cookbook/views/views.py
index f8f35e56d..c0b67434e 100644
--- a/cookbook/views/views.py
+++ b/cookbook/views/views.py
@@ -117,10 +117,13 @@ def meal_plan(request):
@login_required
def shopping_list(request):
+ markdown_format = True
+
if request.method == "POST":
- form = RecipeForm(request.POST)
+ form = ShoppingForm(request.POST)
if form.is_valid():
recipes = form.cleaned_data['recipe']
+ markdown_format = form.cleaned_data['markdown_format']
else:
recipes = []
else:
@@ -132,7 +135,7 @@ def shopping_list(request):
if Recipe.objects.filter(pk=int(r)).exists():
recipes.append(int(r))
- form = RecipeForm(initial={'recipe': recipes})
+ form = ShoppingForm(initial={'recipe': recipes})
ingredients = []
@@ -148,7 +151,7 @@ def shopping_list(request):
else:
ingredients.append(ri)
- return render(request, 'shopping_list.html', {'ingredients': ingredients, 'recipes': recipes, 'form': form})
+ return render(request, 'shopping_list.html', {'ingredients': ingredients, 'recipes': recipes, 'form': form, 'markdown_format': markdown_format})
@login_required