Commit 9f9c2091 authored by Kirby Ezekiel Santos's avatar Kirby Ezekiel Santos

Added the recipes list page

parent dd97decd
...@@ -5,11 +5,13 @@ from .views import IngredientsListView ...@@ -5,11 +5,13 @@ from .views import IngredientsListView
from .views import IngredientsDetailView from .views import IngredientsDetailView
from .views import IngredientsUpdateView from .views import IngredientsUpdateView
from .views import IngredientsCreateView from .views import IngredientsCreateView
from .views import RecipesListView
urlpatterns = [ urlpatterns = [
path('', HomePageView.as_view()), path('', HomePageView.as_view()),
path('ingredients-list', IngredientsListView.as_view()), path('ingredients-list', IngredientsListView.as_view()),
path('ingredients-detail', IngredientsDetailView.as_view()), path('ingredients-detail', IngredientsDetailView.as_view()),
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())
] ]
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
class HomePageView(TemplateView): class HomePageView(TemplateView):
template_name = "home_page.html" template_name = "home_page.html"
......
...@@ -152,7 +152,7 @@ class NewVisitorTest(unittest.TestCase): ...@@ -152,7 +152,7 @@ class NewVisitorTest(unittest.TestCase):
self.assertIn("Recipes - List", self.browser.title) self.assertIn("Recipes - List", self.browser.title)
recipes_list_header = self.browser.find_element_by_id("page_header") recipes_list_header = self.browser.find_element_by_id("page_header")
self.assertEqual( self.assertEqual(
ingredients_list_header.get_attribute("innerHTML"), recipes_list_header.get_attribute("innerHTML"),
"Recipes - List" "Recipes - List"
) )
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<div> <div>
<h2 id="home_page_recipes">Recipes</h2> <h2 id="home_page_recipes">Recipes</h2>
<form> <form method="get" action="http://localhost:8000/recipes-list">
<button type="submit" id="button_to_recipes">Go to recipes</button> <button type="submit" id="button_to_recipes">Go to recipes</button>
</form> </form>
</div> </div>
......
<!DOCTYPE html>
<html>
<head>
<title>Recipes - List</title>
</head>
<body>
<div>
<h1 id="page_header">Recipes - List</h1>
</div>
<div>
<table class="table">
<thead>
<tr>
<th>Recipes</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>
<form>
<button type="submit" id="button_to_recipes_detail">Go to detail</button>
</form>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<form method="get" action="http://localhost:8000">
<button type="submit" id="back_button">Back to Home</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