diff --git a/cookbook/templates/forms/edit_internal_recipe.html b/cookbook/templates/forms/edit_internal_recipe.html
new file mode 100644
index 000000000..a858a0851
--- /dev/null
+++ b/cookbook/templates/forms/edit_internal_recipe.html
@@ -0,0 +1,24 @@
+{% extends "base.html" %}
+{% load crispy_forms_tags %}
+{% load i18n %}
+
+{% block title %}{% trans 'Edit Recipe' %}{% endblock %}
+
+{% block content %}
+
+
{% trans 'Edit Recipe' %}
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/cookbook/urls.py b/cookbook/urls.py
index 11ec8534b..62ad73480 100644
--- a/cookbook/urls.py
+++ b/cookbook/urls.py
@@ -9,7 +9,7 @@ urlpatterns = [
path('test', views.test, name='test'),
path('new/recipe/', new.RecipeCreate.as_view(), name='new_recipe'),
- path('new/recipe_import//', new.create_new_recipe, name='new_recipe_import'),
+ path('new/recipe_import//', new.create_new_external_recipe, name='new_recipe_import'),
path('new/keyword/', new.KeywordCreate.as_view(), name='new_keyword'),
path('new/storage/', new.StorageCreate.as_view(), name='new_storage'),
diff --git a/cookbook/views/edit.py b/cookbook/views/edit.py
index 7f6853d82..7e3c0b8de 100644
--- a/cookbook/views/edit.py
+++ b/cookbook/views/edit.py
@@ -1,14 +1,40 @@
from django.contrib import messages
+from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
-from django.shortcuts import redirect
+from django.shortcuts import redirect, get_object_or_404, render
from django.urls import reverse_lazy, reverse
from django.utils.translation import gettext as _
from django.views.generic import UpdateView, DeleteView
-from cookbook.forms import ExternalRecipeForm, KeywordForm, StorageForm, SyncForm
+from cookbook.forms import ExternalRecipeForm, KeywordForm, StorageForm, SyncForm, InternalRecipeForm
from cookbook.models import Recipe, Sync, Keyword, RecipeImport, Storage
+@login_required
+def edit_internal_recipe(request, pk):
+ recipe_instance = get_object_or_404(Recipe, pk=pk)
+
+ if request.method == "POST":
+ form = InternalRecipeForm(request.POST)
+ if form.is_valid():
+ recipe = Recipe()
+ recipe.name = form.cleaned_data['name']
+ recipe.instructions = form.cleaned_data['instructions']
+
+ recipe.save()
+
+ recipe.keywords.set(form.cleaned_data['keywords'])
+
+ messages.add_message(request, messages.SUCCESS, _('Recipe saved!'))
+ return redirect('index')
+ else:
+ messages.add_message(request, messages.ERROR, _('There was an error importing this recipe!'))
+ else:
+ form = InternalRecipeForm(recipe_instance)
+
+ return render(request, 'forms/edit_internal_recipe.html', {'form': form})
+
+
class SyncUpdate(LoginRequiredMixin, UpdateView):
template_name = "generic/edit_template.html"
model = Sync
diff --git a/cookbook/views/new.py b/cookbook/views/new.py
index fcc4341bb..ae5ba9275 100644
--- a/cookbook/views/new.py
+++ b/cookbook/views/new.py
@@ -47,7 +47,7 @@ class StorageCreate(LoginRequiredMixin, CreateView):
@login_required
-def create_new_recipe(request, import_id):
+def create_new_external_recipe(request, import_id):
if request.method == "POST":
form = ImportRecipeForm(request.POST)
if form.is_valid():