Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI40-Midterm-Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Andrea Tsai
CSCI40-Midterm-Project
Commits
6defcce2
Commit
6defcce2
authored
Mar 18, 2020
by
littleredpanda14
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created tests and urls. Updated views.
parent
0b2f51e9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
5 deletions
+49
-5
janet.html
froyo/templates/janet.html
+10
-0
tests.py
froyo/tests.py
+16
-0
urls.py
froyo/urls.py
+8
-2
views.py
froyo/views.py
+15
-3
No files found.
froyo/templates/janet.html
0 → 100644
View file @
6defcce2
<!DOCTYPE html>
<html>
<head>
<title>
Hi. My name is Janet.
</title>
</head>
<body>
<h1>
Hi. My name is Janet.
</h1>
Welcome. Everything is fine.
</body>
</html>
\ No newline at end of file
froyo/tests.py
View file @
6defcce2
from
django.test
import
TestCase
from
django.test
import
TestCase
# Create your tests here.
# Create your tests here.
class
JanetPageTest
(
TestCase
):
def
test_janet_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/froyo'
)
self
.
assertTemplateUsed
(
response
,
'janet.html'
)
class
IngredientsListPageTest
(
TestCase
):
def
test_ingredients_list_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/froyo/ingredients'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_list.html'
)
class
IngredientsListPageTest
(
TestCase
):
def
test_ingredients_list_page_returns_correct_html
(
self
):
response
=
self
.
client
.
get
(
'/froyo/ingredients'
)
self
.
assertTemplateUsed
(
response
,
'ingredients_list.html'
)
froyo/urls.py
View file @
6defcce2
from
django.conf.urls
import
url
,
include
from
django.conf.urls
import
url
,
include
from
.views
import
JanetView
from
.views
import
IngredientsListView
,
IngredientsDetailView
,
IngredientsUpdateView
,
IngredientsCreateView
from
.views
import
IngredientsListView
,
IngredientsDetailView
,
IngredientsUpdateView
,
IngredientsCreateView
...
@@ -13,6 +16,9 @@ from .views import OrdersListView, OrdersDetailView, OrdersUpdateView, OrdersCre
...
@@ -13,6 +16,9 @@ from .views import OrdersListView, OrdersDetailView, OrdersUpdateView, OrdersCre
urlpatterns
=
[
urlpatterns
=
[
url
(
r'^froyo$'
,
HeroesView
.
as_view
(),
name
=
'hero_list'
),
url
(
r'^froyo$'
,
JanetView
.
as_view
(),
name
=
'janet'
),
url
(
r'^ingredients/almonds$'
,
JesterView
.
as_view
(),
name
=
'jester_detail'
)
url
(
r'^froyo/ingredients$'
,
IngredientsListView
.
as_view
(),
name
=
'ingredients_list'
),
url
(
r'^froyo/ingredients/almonds$'
,
IngredientsDetailView
.
as_view
(),
name
=
'almonds'
),
url
(
r'^froyo/ingredients/update$'
,
IngredientsUpdateView
.
as_view
(),
name
=
'ingredients_update'
),
url
(
r'^froyo/ingredients/create$'
,
IngredientsCreateView
.
as_view
(),
name
=
'ingredients_create'
),
]
]
\ No newline at end of file
froyo/views.py
View file @
6defcce2
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views.generic.base
import
ListView
,
DetailView
,
UpdateView
,
CreateView
from
django.views.generic.base
import
TemplateView
from
django.views.generic
import
ListView
,
DetailView
,
UpdateView
,
CreateView
class
JanetView
(
TemplateView
):
template_name
=
'janet.html'
class
IngredientsListView
(
ListView
):
class
IngredientsListView
(
ListView
):
template_name
=
'ingredients_list.html'
template_name
=
'ingredients_list.html'
...
@@ -45,10 +57,10 @@ class OrdersDetailView(DetailView):
...
@@ -45,10 +57,10 @@ class OrdersDetailView(DetailView):
template_name
=
'orders_detail.html'
template_name
=
'orders_detail.html'
class
Ingredient
UpdateView
(
UpdateView
):
class
Orders
UpdateView
(
UpdateView
):
template_name
=
'orders_update_form.html'
template_name
=
'orders_update_form.html'
class
Ingredient
CreateView
(
CreateView
):
class
Orders
CreateView
(
CreateView
):
template_name
=
'orders_create_form.html'
template_name
=
'orders_create_form.html'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment