Refactored for FT.

parent 04751904
from django.conf.urls import url from django.conf.urls import url
from .views import HomeView from .views import (HomeView, OrdersListView, OrdersDetailView, OrdersUpdateView, OrdersCreateView,
RecipesListView, RecipesDetailView, RecipesUpdateView, RecipesCreateView, IngredientsListView,
IngredientsDetailView, IngredientsUpdateView, IngredientsCreateView)
urlpatterns = [ urlpatterns = [
url(r'^$', HomeView_.asView(), name='home'), url(r'^$', HomeView.as_view(), name='home'),
url(r'^orders$', OrdersListView.asView(), name='orders-list'), url(r'^orders$', OrdersListView.as_view(), name='orders-list'),
url(r'^orders/detail$', OrdersDetailsView.asView(), name='orders-detail'), url(r'^orders/detail$', OrdersDetailView.as_view(), name='orders-detail'),
url(r'^orders/update_form$', OrdersUpdateView.asView(), name='orders-update-form'), url(r'^orders/update_form$', OrdersUpdateView.as_view(), name='orders-update-form'),
url(r'^orders/create_form$', OrdersCreateView.asView(), name='orders-create-form'), url(r'^orders/create_form$', OrdersCreateView.as_view(), name='orders-create-form'),
url(r'^recipes$', RecipesListView.asView(), name='recipes-list'), url(r'^recipes$', RecipesListView.as_view(), name='recipes-list'),
url(r'^recipes/detail$', RecipesDetailsView.asView(), name='recipes-detail'), url(r'^recipes/detail$', RecipesDetailView.as_view(), name='recipes-detail'),
url(r'^recipes/update_form$', RecipesUpdateView.asView(), name='recipes-update-form'), url(r'^recipes/update_form$', RecipesUpdateView.as_view(), name='recipes-update-form'),
url(r'^recipes/create_form$', RecipesCreateView.asView(), name='recipes-create-form'), url(r'^recipes/create_form$', RecipesCreateView.as_view(), name='recipes-create-form'),
url(r'^ingredients$', IngredientsListView.asView(), name='ingredients-list'), url(r'^ingredients$', IngredientsListView.as_view(), name='ingredients-list'),
url(r'^ingredients/detail$', IngredientsDetailsView.asView(), name='ingredients-detail'), url(r'^ingredients/detail$', IngredientsDetailView.as_view(), name='ingredients-detail'),
url(r'^ingredients/update_form$', IngredientsUpdateView.asView(), name='ingredients-update-form'), url(r'^ingredients/update_form$', IngredientsUpdateView.as_view(), name='ingredients-update-form'),
url(r'^ingredients/create_form$', IngredientsCreateView.asView(), name='ingredients-create-form'), url(r'^ingredients/create_form$', IngredientsCreateView.as_view(), name='ingredients-create-form'),
] ]
...@@ -53,13 +53,13 @@ class NewVisitorTest(unittest.TestCase): ...@@ -53,13 +53,13 @@ class NewVisitorTest(unittest.TestCase):
#One of the employees, a deliveryman, arrive with a package of dry ice. Wishing to keep track of the change, #One of the employees, a deliveryman, arrive with a package of dry ice. Wishing to keep track of the change,
#They add it to the list. #They add it to the list.
self.browser.get('http://localhost:8000/ingredients') self.browser.get('http://localhost:8000/ingredients')
self.assertIn('ingredients - List', self.browser.title) self.assertIn('Ingredients - List', self.browser.title)
#After some looking, they find a button that would allow them to add their ingredients. #After some looking, they find a button that would allow them to add their ingredients.
self.browser.get('http://localhost:8000/ingredients/create_form') self.browser.get('http://localhost:8000/ingredients/create_form')
self.assertIn('ingredients - Create', self.browser.title) self.assertIn('Ingredients - Create', self.browser.title)
self.browser.get('http://localhost:8000/ingredients/update_form') self.browser.get('http://localhost:8000/ingredients/update_form')
self.assertIn('ingredients - Update', self.browser.title) self.assertIn('Ingredients - Update', self.browser.title)
def test_can_display_ingredient_details(self): def test_can_display_ingredient_details(self):
#The employee wanted to know how much dry ice they currently have, so they click on the entry. #The employee wanted to know how much dry ice they currently have, so they click on the entry.
......
...@@ -13,7 +13,7 @@ Including another URLconf ...@@ -13,7 +13,7 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf.urls import url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
urlpatterns = [ urlpatterns = [
......
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