Fakultas Ilmu Komputer UI

Commit c0f59faf authored by Muhamad Lutfi Arif's avatar Muhamad Lutfi Arif
Browse files

Merge branch '1706979360-109' into 'master'

[#109] Material: Requested List (Contributor View)

See merge request !78
parents 59a5a847 61cb6fb9
Pipeline #60012 failed with stages
in 21 minutes and 41 seconds
......@@ -72,8 +72,26 @@
</div>
</div>
</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>
<!-- /.container -->
......
......@@ -2250,6 +2250,14 @@ class RequestMateriTest(TestCase):
self.assertIn('Missing parameter', response.content.decode())
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):
def setUp(self):
......
......@@ -506,6 +506,7 @@ class ReqMateriView(TemplateView):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
context['requested_material'] = ReqMaterial.objects.all()
return self.render_to_response(context)
def post(self, request, *args, **kwargs):
......
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