removed categories

This commit is contained in:
vabene1111
2019-11-13 21:46:03 +01:00
parent 0fd19edcc2
commit b98f87499a
11 changed files with 12 additions and 110 deletions

View File

@ -53,16 +53,12 @@ def batch_edit(request):
form = BatchEditForm(request.POST)
if form.is_valid():
word = form.cleaned_data['search']
category = form.cleaned_data['category']
keywords = form.cleaned_data['keywords']
recipes = Recipe.objects.filter(name__contains=word)
count = 0
for recipe in recipes:
edit = False
if category is not None:
recipe.category = category
edit = True
if keywords.__sizeof__() > 0:
recipe.keywords.add(*list(keywords))
edit = True
@ -94,11 +90,9 @@ class Object(object):
def statistics(request):
counts = Object()
counts.recipes = Recipe.objects.count()
counts.categories = Category.objects.count()
counts.keywords = Keyword.objects.count()
counts.recipe_import = RecipeImport.objects.count()
counts.recipes_no_category = Recipe.objects.filter(category__isnull=True).count()
counts.recipes_no_keyword = Recipe.objects.filter(keywords=None).count()
return render(request, 'stats.html', {'counts': counts})