Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Collection of Practice
2019
1606875806-practice
Commits
d6d5d0f7
Commit
d6d5d0f7
authored
Dec 23, 2019
by
Izzan Fakhril Islam
Browse files
implement remove todo and todo commentary
parent
4509a9cf
Pipeline
#28206
passed with stages
in 74 minutes and 49 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
1606875806_IzzanFakhrilIslam_B.txt
0 → 100644
View file @
d6d5d0f7
URL Gitlab = https://gitlab.cs.ui.ac.id/pmpl/practice-collection/2019/1606875806-practice
Branch penyimpanan hasil implementasi = https://gitlab.cs.ui.ac.id/pmpl/practice-collection/2019/1606875806-practice/tree/takehome-final-exam
tutorial_7/functional_tests/test_login.py
View file @
d6d5d0f7
...
...
@@ -25,7 +25,7 @@ class LoginTest(FunctionalTest):
# She checks her email and finds a message
email
=
mail
.
outbox
[
0
]
self
.
assertIn
(
TEST_EMAIL
,
email
.
to
)
self
.
assertEqual
(
email
.
subject
,
SUBJECT
)
self
.
assertEqual
(
SUBJECT
,
email
.
subject
)
# It has a url link in it
self
.
assertIn
(
'Use this link to log in'
,
email
.
body
)
...
...
tutorial_7/templates/partials/header_tutorial_7.html
View file @
d6d5d0f7
...
...
@@ -17,7 +17,7 @@
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand"
href=
"{% url 'tutorial-7:index' %}"
style=
"color: black"
>
Tutorial 7 PMPL
</a>
<a
class=
"navbar-brand"
href=
"{% url 'tutorial-7:index' %}"
style=
"color: black"
>
Tutorial 7 PMPL
by {{ author }}
</a>
</div>
</div>
</nav>
tutorial_7/views.py
View file @
d6d5d0f7
...
...
@@ -4,6 +4,7 @@ from django.core.exceptions import ValidationError
from
django.contrib.auth
import
authenticate
from
django.contrib.auth
import
login
as
auth_login
from
django.contrib.auth
import
logout
as
auth_logout
from
django.shortcuts
import
get_object_or_404
from
django.shortcuts
import
render
,
redirect
from
.models
import
TodoList
,
TodoListCommentary
,
Token
from
datetime
import
datetime
...
...
@@ -38,6 +39,7 @@ def login(request):
user
=
auth
.
authenticate
(
uid
=
uid
)
if
user
is
not
None
:
auth
.
login
(
request
,
user
)
return
redirect
(
'/tutorial-7/'
)
...
...
@@ -69,6 +71,12 @@ def add_todo(request):
return
render
(
request
,
HTML_FILE
,
response
)
def
delete_todo
(
request
,
id
=
None
):
todo_object
=
get_object_or_404
(
TodoList
,
pk
=
id
)
todo_object
.
delete
()
return
redirect
(
'/tutorial-7/'
)
def
add_todo_commentary
(
request
):
if
request
.
method
==
'POST'
:
try
:
...
...
@@ -87,6 +95,12 @@ def add_todo_commentary(request):
return
render
(
request
,
HTML_FILE
,
response
)
def
delete_todo_commentary
(
request
,
id
=
None
):
todo_commentary_object
=
get_object_or_404
(
TodoListCommentary
,
pk
=
id
)
todo_commentary_object
.
delete
()
return
redirect
(
'/tutorial-7/'
)
def
send_login_email
(
request
):
email
=
request
.
POST
[
'email'
]
uid
=
str
(
uuid
.
uuid4
())
...
...
Write
Preview
Supports
Markdown
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