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
Class Project
DIGIPUS
Commits
61cb6fb9
Commit
61cb6fb9
authored
Oct 30, 2020
by
Muhamad Lutfi Arif
Browse files
[
#109
] Material: Requested List (Contributor View)
parent
59a5a847
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/templates/req_materi.html
View file @
61cb6fb9
...
@@ -72,8 +72,26 @@
...
@@ -72,8 +72,26 @@
</div>
</div>
</div>
</div>
</header>
</header>
{% if requested_material %}
<table
class=
"table"
>
<thead>
<tr>
<th
scope=
"col"
>
No
</th>
<th
scope=
"col"
>
Title
</th>
<th
scope=
"col"
>
Date
</th>
</tr>
</thead>
<tbody>
{% for material in requested_material %}
<tr>
<td>
{{ forloop.counter }}
</td>
<td>
{{ material.title }}
</td>
<td>
{{ material.timestamp }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
<!-- /.container -->
<!-- /.container -->
...
...
app/tests.py
View file @
61cb6fb9
...
@@ -2250,6 +2250,14 @@ class RequestMateriTest(TestCase):
...
@@ -2250,6 +2250,14 @@ class RequestMateriTest(TestCase):
self
.
assertIn
(
'Missing parameter'
,
response
.
content
.
decode
())
self
.
assertIn
(
'Missing parameter'
,
response
.
content
.
decode
())
self
.
client
.
logout
()
self
.
client
.
logout
()
def
test_displays_all_requested_material
(
self
):
self
.
client
.
login
(
**
self
.
contributor_credential
)
first_material_request
=
ReqMaterial
(
title
=
"Material 1"
).
save
()
second_material_request
=
ReqMaterial
(
title
=
"Material 2"
).
save
()
response
=
self
.
client
.
get
(
self
.
url
)
self
.
assertContains
(
response
,
'Material 1'
)
self
.
assertContains
(
response
,
'Material 2'
)
class
RatingContributorTest
(
TransactionTestCase
):
class
RatingContributorTest
(
TransactionTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
app/views.py
View file @
61cb6fb9
...
@@ -506,6 +506,7 @@ class ReqMateriView(TemplateView):
...
@@ -506,6 +506,7 @@ class ReqMateriView(TemplateView):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
context
=
self
.
get_context_data
(
**
kwargs
)
context
=
self
.
get_context_data
(
**
kwargs
)
context
[
'requested_material'
]
=
ReqMaterial
.
objects
.
all
()
return
self
.
render_to_response
(
context
)
return
self
.
render_to_response
(
context
)
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
...
...
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