Merged in [19180] from rcross@amsl.com:

Fix Telechat app bug, draft with no ballot.
 - Legacy-Id: 19181
Note: SVN reference [19180] has been migrated to Git commit d216a18734
This commit is contained in:
Robert Sparks 2021-07-01 17:29:31 +00:00
commit 9621eafa2f
2 changed files with 13 additions and 0 deletions

View file

@ -105,6 +105,17 @@ class SecrTelechatTestCase(TestCase):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_doc_detail_draft_no_ballot(self):
draft = IndividualDraftFactory(name='draft-imaginary-independent-submission')
by=Person.objects.get(name="(System)")
d = get_next_telechat_date()
date = d.strftime('%Y-%m-%d')
update_telechat(None, draft, by, d)
url = reverse('ietf.secr.telechat.views.doc_detail', kwargs={'date':date, 'name':draft.name})
self.client.login(username="secretary", password="secretary+password")
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
def test_doc_detail_charter(self):
by=Person.objects.get(name="(System)")
charter = CharterFactory(states=[('charter','intrev')])

View file

@ -216,6 +216,8 @@ def doc_detail(request, date, name):
# need to use curry here to pass custom variable to form init
if doc.active_ballot():
ballot_type = doc.active_ballot().ballot_type
elif doc.type.slug == 'draft':
ballot_type = BallotType.objects.get(doc_type__slug='draft', slug='approve')
else:
ballot_type = BallotType.objects.get(doc_type=doc.type)
BallotFormset = formset_factory(BallotForm, extra=0)