Commit f0b85398 authored by cianlaguesma's avatar cianlaguesma

fixed views and urls

parent 377eb7bd
from django.conf.urls import url
from .views import ingredients_list, ingredients_detail, ingredients_update_form, ingredients_create_form, recipes_list, recipes_detail, recipes_update_form, recipes_create_form, orders_list, orders_detail, orders_update_form, orders_create_form, home_page
urlpatterns = [
url(r'^index$', home_page, name='home_page'),
url(r'^ingredients/list$', ingredients_list, name='ingredients_list'),
url(r'^ingredients/detail$', ingredients_detail, name='ingredients_detail'),
url(r'^ingredients/update_form$', ingredients_update_form, name='ingredients_update_form'),
url(r'^ingredients/create_form$', ingredients_create_form, name='ingredients_create_form'),
url(r'^recipes/list$', recipes_list, name='recipes_list'),
url(r'^recipes/detail$', recipes_detail, name='recipes_detail'),
url(r'^recipes/update_form$', recipes_update_form, name='recipes_update_form'),
url(r'^recipes/create_form$', recipes_create_form, name='recipes_create_form'),
url(r'^orders/list$', orders_list, name='orders_list'),
url(r'^orders/detail$', orders_detail, name='orders_detail'),
url(r'^orders/update_form$', orders_update_form, name='orders_update_form'),
url(r'^orders/create_form$', orders_create_form, name='recipes_create_form'),
url(r'^index$', home_page.as_view(), name='home_page'),
url(r'^ingredients/list$', ingredients_list.as_view(), name='ingredients_list'),
url(r'^ingredients/detail$', ingredients_detail.as_view(), name='ingredients_detail'),
url(r'^ingredients/update_form$', ingredients_update_form.as_view(), name='ingredients_update_form'),
url(r'^ingredients/create_form$', ingredients_create_form.as_view(), name='ingredients_create_form'),
url(r'^recipes/list$', recipes_list.as_view(), name='recipes_list'),
url(r'^recipes/detail$', recipes_detail.as_view(), name='recipes_detail'),
url(r'^recipes/update_form$', recipes_update_form.as_view(), name='recipes_update_form'),
url(r'^recipes/create_form$', recipes_create_form.as_view(), name='recipes_create_form'),
url(r'^orders/list$', orders_list.as_view(), name='orders_list'),
url(r'^orders/detail$', orders_detail.as_view(), name='orders_detail'),
url(r'^orders/update_form$', orders_update_form.as_view(), name='orders_update_form'),
url(r'^orders/create_form$', orders_create_form.as_view(), name='recipes_create_form'),
]
from django.shortcuts import render
from django.views.generic.base import TemplateView
def home_page(request):
return render(request, 'index.html')
class home_page(TemplateView):
template_name = 'index.html'
def ingredients_list(request):
return render(request,'ingredients_list.html')
class ingredients_list(TemplateView):
template_name = 'ingredients_list.html'
def ingredients_detail(request):
return render(request,'ingredients_detail.html')
class ingredients_detail(TemplateView):
template_name = 'ingredients_detail.html'
def ingredients_update_form(request):
return render(request,'ingredients_update_form.html')
class ingredients_update_form(TemplateView):
template_name = 'ingredients_update_form.html'
def ingredients_create_form(request):
return render(request,'ingredients_create_form.html')
class ingredients_create_form(TemplateView):
template_name = 'ingredients_create_form.html'
def recipes_list(request):
return render(request,'recipes_list.html')
class recipes_list(TemplateView):
template_name = 'recipes_list.html'
def recipes_detail(request):
return render(request,'recipes_detail.html')
class recipes_detail(TemplateView):
template_name = 'recipes_detail.html'
def recipes_update_form(request):
return render(request,'recipes_update_form.html')
class recipes_update_form(TemplateView):
template_name = 'recipes_update_form.html'
def recipes_create_form(request):
return render(request,'recipes_create_form.html')
class recipes_create_form(TemplateView):
template_name = 'recipes_create_form.html'
def orders_list(request):
return render(request,'orders_list.html')
class orders_list(TemplateView):
template_name = 'orders_list.html'
def orders_detail(request):
return render(request,'orders_detail.html')
class orders_detail(TemplateView):
template_name = 'orders_detail.html'
def orders_update_form(request):
return render(request,'orders_update_form.html')
class orders_update_form(TemplateView):
template_name = 'orders_update_form.html'
def orders_create_form(request):
return render(request,'orders_create_form.html')
class orders_create_form(TemplateView):
template_name = 'orders_create_form.html'
# Create your views here.
......@@ -61,7 +61,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/ingredients/detail',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_detail_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -79,7 +79,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/ingredients/list',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("ingredients_list_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -96,7 +96,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/create_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_create_form_header"))
# After Updating the ingredient, he went back home
# After creating the form, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -114,8 +114,8 @@ class NewVisitorTest(unittest.TestCase):
update_order.click()
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/update_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_create_form_header"))
# After Updating the ingredient, he went back home
self.assertTrue(self.browser.find_element_by_id("orders_update_form_header"))
# After Updating the order, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -126,7 +126,7 @@ class NewVisitorTest(unittest.TestCase):
def test_froyo_display_detail_orders(self):
#He also wanted to look at the detail of a record for an orderso he went and looked at one and he noticed the header Orders - Detail
#He also wanted to look at the detail of a record for an order so he went and looked at one and he noticed the header Orders - Detail
self.browser.get('http://localhost:8000/index')
......@@ -135,7 +135,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/detail',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_detail_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -153,7 +153,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/orders/list',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("orders_list_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -170,7 +170,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/create_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_create_form_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -187,7 +187,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/update_form',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_update_form_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -204,7 +204,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/detail',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_detail_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......@@ -221,7 +221,7 @@ class NewVisitorTest(unittest.TestCase):
time.sleep(1)
self.assertEqual('http://localhost:8000/recipes/list',self.browser.current_url)
self.assertTrue(self.browser.find_element_by_id("recipes_list_header"))
# After Updating the ingredient, he went back home
# After this, he went back home
home = self.browser.find_element_by_id('home')
home.click()
time.sleep(1)
......
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