diff --git a/ietf/community/tests.py b/ietf/community/tests.py index 5d50b0151..062cb6d76 100644 --- a/ietf/community/tests.py +++ b/ietf/community/tests.py @@ -123,7 +123,7 @@ class CommunityListTests(TestCase): self.assertContains(r, draft.name) # remove document - r = self.client.post(url, { "action": "remove_document", "document": draft.name }) + r = self.client.post(url, { "action": "remove_document", "document": draft.pk }) self.assertEqual(r.status_code, 302) clist = CommunityList.objects.get(user__username="plain") self.assertTrue(not clist.added_docs.filter(pk=draft.pk)) diff --git a/ietf/community/views.py b/ietf/community/views.py index 09a12ab93..c1a061e5d 100644 --- a/ietf/community/views.py +++ b/ietf/community/views.py @@ -67,9 +67,9 @@ def manage_list(request, username=None, acronym=None, group_type=None): add_doc_form = AddDocumentsForm() if request.method == 'POST' and action == 'remove_document': - document_name = request.POST.get('document') - if clist.pk is not None and document_name: - document = get_object_or_404(clist.added_docs, name=document_name) + document_id = request.POST.get('document') + if clist.pk is not None and document_id: + document = get_object_or_404(clist.added_docs, id=document_id) clist.added_docs.remove(document) return HttpResponseRedirect("")