batch edit

This commit is contained in:
vabene1111
2018-02-08 22:22:51 +01:00
parent 59641e1af6
commit 8413383e12
10 changed files with 189 additions and 223 deletions

View File

@@ -20,34 +20,6 @@ def index(request):
return render(request, 'index.html')
@login_required
def batch_import(request):
if request.method == "POST":
form = ImportForm(request.POST)
if form.is_valid():
dropbox.import_all(form.cleaned_data['path'])
return redirect('index')
else:
form = ImportForm()
return render(request, 'batch/import.html', {'form': form})
@login_required
def batch_category(request):
if request.method == "POST":
form = BatchCategoryForm(request.POST)
if form.is_valid():
word = form.cleaned_data['search']
category = form.cleaned_data['category']
Recipe.objects.filter(name__contains=word).update(category=(Category.objects.get(name=category)).id)
return redirect('index')
else:
form = BatchCategoryForm()
return render(request, 'batch/category.html', {'form': form})
@login_required
def edit_recipe(request, recipe_id):
if request.method == "POST":