Commit 6691cc99 authored by Karlo Cabugwang's avatar Karlo Cabugwang

changed to templateview and all tests passed

parent 2b928581
......@@ -20,4 +20,46 @@ class IngredientsCreateViewTest(TestCase):
class IngredientsUpdateViewTest(TestCase):
def test_can_open_ingredients_update_view_temp(self):
response = self.client.get('/ingredients/update')
self.assertTemplateUsed(response, 'ingredients_update_form.html')
\ No newline at end of file
self.assertTemplateUsed(response, 'ingredients_update_form.html')
class OrdersListViewTest(TestCase):
def test_can_open_orders_list_view_temp(self):
response = self.client.get('/orders')
self.assertTemplateUsed(response, 'orders_list.html')
class OrdersDetailViewTest(TestCase):
def test_can_open_orders_detail_view_temp(self):
response = self.client.get('/orders/detail')
self.assertTemplateUsed(response, 'orders_detail.html')
class OrdersCreateViewTest(TestCase):
def test_can_open_orders_create_view_temp(self):
response = self.client.get('/orders/new')
self.assertTemplateUsed(response, 'orders_create_form.html')
class OrdersUpdateViewTest(TestCase):
def test_can_open_orders_update_view_temp(self):
response = self.client.get('/orders/update')
self.assertTemplateUsed(response, 'orders_update_form.html')
class RecipesListViewTest(TestCase):
def test_can_open_recipes_list_view_temp(self):
response = self.client.get('/recipes')
self.assertTemplateUsed(response, 'recipes_list.html')
class RecipesDetailViewTest(TestCase):
def test_can_open_recipes_detail_view_temp(self):
response = self.client.get('/recipes/detail')
self.assertTemplateUsed(response, 'recipes_detail.html')
class RecipesCreateViewTest(TestCase):
def test_can_open_recipes_create_view_temp(self):
response = self.client.get('/recipes/new')
self.assertTemplateUsed(response, 'recipes_create_form.html')
class RecipesUpdateViewTest(TestCase):
def test_can_open_recipes_update_view_temp(self):
response = self.client.get('/recipes/update')
self.assertTemplateUsed(response, 'recipes_update_form.html')
\ No newline at end of file
......@@ -14,8 +14,8 @@ urlpatterns = [
url(r'^orders/new$', OrdersCreateView.as_view(), name='orders_create'),
url(r'^orders/update$', OrdersUpdateView.as_view(), name='orders_update'),
url(r'^recipes$', IngredientsListView.as_view(), name='recipes_list'),
url(r'^recipes/detail$', IngredientsDetailView.as_view(), name='recipes_detail'),
url(r'^recipes/new$', IngredientsCreateView.as_view(), name='recipes_create'),
url(r'^recipes/update$', IngredientsUpdateView.as_view(), name='recipes_update'),
url(r'^recipes$', RecipesListView.as_view(), name='recipes_list'),
url(r'^recipes/detail$', RecipesDetailView.as_view(), name='recipes_detail'),
url(r'^recipes/new$', RecipesCreateView.as_view(), name='recipes_create'),
url(r'^recipes/update$', RecipesUpdateView.as_view(), name='recipes_update'),
]
\ No newline at end of file
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView
from .models import *
class IngredientsListView(ListView):
class IngredientsListView(TemplateView):
template_name = "ingredients_list.html"
class IngredientsDetailView(DetailView):
class IngredientsDetailView(TemplateView):
template_name = "ingredients_detail.html"
class IngredientsCreateView(CreateView):
class IngredientsCreateView(TemplateView):
template_name = "ingredients_create_form.html"
class IngredientsUpdateView(UpdateView):
class IngredientsUpdateView(TemplateView):
template_name = "ingredients_update_form.html"
class OrdersListView(ListView):
class OrdersListView(TemplateView):
template_name = "orders_list.html"
class OrdersDetailView(DetailView):
class OrdersDetailView(TemplateView):
template_name = "orders_detail.html"
class OrdersCreateView(CreateView):
class OrdersCreateView(TemplateView):
template_name = "orders_create_form.html"
class OrdersUpdateView(UpdateView):
class OrdersUpdateView(TemplateView):
template_name = "orders_update_form.html"
class RecipesListView(ListView):
class RecipesListView(TemplateView):
template_name = "recipes_list.html"
class RecipesDetailView(DetailView):
class RecipesDetailView(TemplateView):
template_name = "recipes_detail.html"
class RecipesCreateView(CreateView):
class RecipesCreateView(TemplateView):
template_name = "recipes_create_form.html"
class RecipesUpdateView(UpdateView):
class RecipesUpdateView(TemplateView):
template_name = "recipes_update_form.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