diff --git a/app/templates/req_materi.html b/app/templates/req_materi.html index f4d071bab3f96663ae5575ecc911a502a5ad77ff..1d4849c7abadd3f367ab340d7f1e95db4a8731f9 100644 --- a/app/templates/req_materi.html +++ b/app/templates/req_materi.html @@ -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 --> diff --git a/app/tests.py b/app/tests.py index 0a16cc1c66b46fad577c798b5c119cb7e725fff0..b1c89f0de162bb1a3a94e09052b9f77bfabb5cf2 100644 --- a/app/tests.py +++ b/app/tests.py @@ -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): diff --git a/app/views.py b/app/views.py index a6c7ca187c0acdf4f0b91e705297c4264f5733c5..4c7454c7f2ec0866f3e5ed3fcd812476c27751cb 100644 --- a/app/views.py +++ b/app/views.py @@ -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):