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

@ -6,14 +6,14 @@ from django.urls import reverse_lazy
from django.utils.translation import gettext as _
from django.views.generic import CreateView
from cookbook.forms import ImportRecipeForm, RecipeImport, CategoryForm, KeywordForm, Storage, StorageForm
from cookbook.models import Category, Keyword, Recipe
from cookbook.forms import ImportRecipeForm, RecipeImport, KeywordForm, Storage, StorageForm
from cookbook.models import Keyword, Recipe
class RecipeCreate(LoginRequiredMixin, CreateView): # this exists for completeness but is not in use at the moment
template_name = "generic/new_template.html"
model = Recipe
fields = ['name', 'category', 'keywords']
fields = ['name', 'keywords']
success_url = reverse_lazy('index')
def get_context_data(self, **kwargs):
@ -22,18 +22,6 @@ class RecipeCreate(LoginRequiredMixin, CreateView): # this exists for completen
return context
class CategoryCreate(LoginRequiredMixin, CreateView):
template_name = "generic/new_template.html"
model = Category
form_class = CategoryForm
success_url = reverse_lazy('list_category')
def get_context_data(self, **kwargs):
context = super(CategoryCreate, self).get_context_data(**kwargs)
context['title'] = _("Category")
return context
class KeywordCreate(LoginRequiredMixin, CreateView):
template_name = "generic/new_template.html"
model = Keyword
@ -69,7 +57,6 @@ def create_new_recipe(request, import_id):
recipe.name = form.cleaned_data['name']
recipe.file_path = form.cleaned_data['file_path']
recipe.file_uid = form.cleaned_data['file_uid']
recipe.category = form.cleaned_data['category']
recipe.save()