diff --git a/cookbook/forms.py b/cookbook/forms.py index 41aba506d..3e1e9bc57 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -124,6 +124,7 @@ class ImportForm(ImportExportBase): class ExportForm(ImportExportBase): recipes = forms.ModelMultipleChoiceField(widget=MultiSelectWidget, queryset=Recipe.objects.none()) + all = forms.BooleanField() def __init__(self, *args, **kwargs): space = kwargs.pop('space') diff --git a/cookbook/integration/cheftap.py b/cookbook/integration/cheftap.py index 112f2f4da..5deb9313e 100644 --- a/cookbook/integration/cheftap.py +++ b/cookbook/integration/cheftap.py @@ -13,9 +13,6 @@ class ChefTap(Integration): print("testing", zip_info_object.filename) return re.match(r'^recipes/([A-Za-z\d\w\s-])+.txt$', zip_info_object.filename) - def is_duplicate(self, recipe): - return None - def get_recipe_from_file(self, file): source_url = '' @@ -45,6 +42,7 @@ class ChefTap(Integration): if source_url != '': step.instruction += '\n' + source_url + step.save() for ingredient in ingredients: amount, unit, ingredient, note = parse(ingredient) diff --git a/cookbook/views/import_export.py b/cookbook/views/import_export.py index 255e6be74..3dd0815e0 100644 --- a/cookbook/views/import_export.py +++ b/cookbook/views/import_export.py @@ -68,8 +68,11 @@ def export_recipe(request): form = ExportForm(request.POST, space=request.space) if form.is_valid(): try: + recipes = form.cleaned_data['recipes'] + if form['all']: + recipes = Recipe.objects.filter(space=request.space, internal=True).all() integration = get_integration(request, form.cleaned_data['type']) - return integration.do_export(form.cleaned_data['recipes']) + return integration.do_export(recipes) except NotImplementedError: messages.add_message(request, messages.ERROR, _('Exporting is not implemented for this provider'))