Commit 56dfdf55 authored by Kirby Ezekiel Santos's avatar Kirby Ezekiel Santos

Added the recipe update form page

parent 853d64e2
...@@ -39,4 +39,4 @@ class RecipesDetailPageTest(TestCase): ...@@ -39,4 +39,4 @@ class RecipesDetailPageTest(TestCase):
class RecipesUpdatePageTest(TestCase): class RecipesUpdatePageTest(TestCase):
def test_recipes_update_page_returns_correct_html(self): def test_recipes_update_page_returns_correct_html(self):
response = self.client.get('/recipes-update') response = self.client.get('/recipes-update')
self.assertTemplateUsed(response, 'recipes_update.html') self.assertTemplateUsed(response, 'recipes_update_form.html')
...@@ -7,6 +7,7 @@ from .views import IngredientsUpdateView ...@@ -7,6 +7,7 @@ from .views import IngredientsUpdateView
from .views import IngredientsCreateView from .views import IngredientsCreateView
from .views import RecipesListView from .views import RecipesListView
from .views import RecipesDetailView from .views import RecipesDetailView
from .views import RecipesUpdateView
urlpatterns = [ urlpatterns = [
path('', HomePageView.as_view()), path('', HomePageView.as_view()),
...@@ -15,5 +16,6 @@ urlpatterns = [ ...@@ -15,5 +16,6 @@ urlpatterns = [
path('ingredients-update', IngredientsUpdateView.as_view()), path('ingredients-update', IngredientsUpdateView.as_view()),
path('ingredients-create', IngredientsCreateView.as_view()), path('ingredients-create', IngredientsCreateView.as_view()),
path('recipes-list', RecipesListView.as_view()), path('recipes-list', RecipesListView.as_view()),
path('recipes-detail', RecipesDetailView.as_view()) path('recipes-detail', RecipesDetailView.as_view()),
path('recipes-update', RecipesUpdateView.as_view())
] ]
...@@ -20,3 +20,6 @@ class RecipesListView(TemplateView): ...@@ -20,3 +20,6 @@ class RecipesListView(TemplateView):
class RecipesDetailView(TemplateView): class RecipesDetailView(TemplateView):
template_name = "recipes_detail.html" template_name = "recipes_detail.html"
class RecipesUpdateView(TemplateView):
template_name = "recipes_update_form.html"
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</div> </div>
<div> <div>
<form> <form method="get" action="http://localhost:8000/recipes-update">
<button type="submit" id="button_to_recipes_update">Update Fields</button> <button type="submit" id="button_to_recipes_update">Update Fields</button>
</form> </form>
</div> </div>
......
<!DOCTYPE html>
<html>
<head>
<title>Recipes - Update</title>
</head>
<body>
<div>
<h1 id="page_header">Recipes - Update</h1>
</div>
<div>
<table class="table">
<thead>
<tr>
<th>Field</th>
<th>Current Value</th>
<th>New Value</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
<form>
<td>
<input type="text">
</td>
<td>
<button type="submit">Save Changes</button>
</td>
</form>
</tr>
</tbody>
</table>
</div>
<div>
<form method="get" action="http://localhost:8000/recipes-detail">
<button type="submit" id="back_button">Back to Detail</button>
</form>
</div>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment