Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
DIGIPUS
Commits
f69dbb97
Commit
f69dbb97
authored
Oct 09, 2020
by
Selvy Fitriani
Browse files
1706039446 36
parent
26195ff4
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/templates/dashboard.html
View file @
f69dbb97
...
...
@@ -3,7 +3,7 @@
{% block title %}
<title>
Riwayat Unggah | Digipus
</title>
{% endblock %}
{% endblock %}
{% block content %}
<!-- Page Heading -->
...
...
@@ -43,10 +43,12 @@
<td
class=
"verif-buttons"
>
<span>
<a
href=
"/materi/{{materi.id}}/"
class=
"accept-button button-decoration"
style=
"background-color:#4e73df"
>
Detail
</a>
style=
"background-color:#4e73df"
>
Detail
</a>
{% if materi.get_status_display == "Ditolak" or materi.get_status_display == "Perbaikan" %}
<a
href=
"/revisi/materi/{{materi.id}}/"
class=
"reject-button button-decoration"
>
Revisi
</a>
{% endif %}
<a
type=
"button"
href=
"/materi/{{materi.id}}/delete"
class=
"reject-button button-decoration"
style=
"background-color:red"
>
Hapus
</a>
</span>
</td>
</tr>
...
...
app/tests.py
View file @
f69dbb97
...
...
@@ -917,6 +917,25 @@ class DashboardKontributorViewTest(TestCase):
self
.
assertIn
(
ERROR_403_MESSAGE
,
html
)
class
DeleteMateriTest
(
TestCase
):
def
setUp
(
self
):
self
.
client
=
Client
()
self
.
content
=
SimpleUploadedFile
(
"content.txt"
,
b
"Test"
)
self
.
cover
=
SimpleUploadedFile
(
"flower.jpg"
,
b
"Test file"
)
self
.
contributor
=
User
.
objects
.
create_contributor
(
email
=
"kontributor@gov.id"
,
password
=
"kontributor"
)
Materi
(
title
=
"Materi 1"
,
author
=
"Agas"
,
uploader
=
self
.
contributor
,
publisher
=
"Kelas SC"
,
descriptions
=
"Deskripsi Materi 1"
,
status
=
"APPROVE"
,
cover
=
self
.
cover
,
content
=
self
.
content
).
save
()
self
.
materi1
=
Materi
.
objects
.
first
()
self
.
url
=
"/materi/"
+
str
(
self
.
materi1
.
id
)
+
"/delete"
def
test_url_delete_materi_is_success
(
self
):
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertEqual
(
response
.
status_code
,
302
)
class
ProfilAdminTest
(
TestCase
):
def
setUp
(
self
):
self
.
client
=
Client
()
...
...
app/urls.py
View file @
f69dbb97
...
...
@@ -13,6 +13,7 @@ urlpatterns = [
path
(
"materi/like/"
,
views
.
toggle_like
,
name
=
"PostLikeToggle"
),
path
(
"delete/<int:pk_materi>/<int:pk_comment>"
,
views
.
delete_comment
,
name
=
"delete-comment"
),
path
(
"materi/<int:pk>/delete"
,
views
.
delete_materi
,
name
=
"detele-materi"
),
path
(
"materi/<int:pk>/unduh"
,
views
.
download_materi
,
name
=
"download-materi"
),
path
(
"materi/<int:pk>/view"
,
views
.
view_materi
,
name
=
"view-materi"
),
path
(
"dashboard/"
,
DashboardKontributorView
.
as_view
(),
name
=
"dashboard"
),
...
...
app/views.py
View file @
f69dbb97
...
...
@@ -348,6 +348,11 @@ def view_materi(request, pk):
raise
Http404
(
"File tidak dapat ditemukan."
)
def
delete_materi
(
request
,
pk
):
materi
=
get_object_or_404
(
Materi
,
pk
=
pk
)
materi
.
delete
()
return
HttpResponseRedirect
(
"/dashboard/"
)
class
UploadMateriView
(
TemplateView
):
template_name
=
"unggah.html"
context
=
{}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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