Fakultas Ilmu Komputer UI

Commit d6d5d0f7 authored by Izzan Fakhril Islam's avatar Izzan Fakhril Islam
Browse files

implement remove todo and todo commentary

parent 4509a9cf
Pipeline #28206 passed with stages
in 74 minutes and 49 seconds
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
......@@ -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)
......
......@@ -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>
......@@ -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())
......
Supports Markdown
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