diff --git a/sponsors/pdf.py b/sponsors/pdf.py index f1b80d911..9855beee3 100644 --- a/sponsors/pdf.py +++ b/sponsors/pdf.py @@ -34,7 +34,9 @@ def _contract_context(contract, **context): "legal_clauses": _clean_split(contract.legal_clauses.raw), "renewal": contract.sponsorship.renewal, }) - context["previous_effective"] = contract.sponsorship.previous_effective_date if contract.sponsorship.previous_effective_date else "UNKNOWN" + previous_effective = contract.sponsorship.previous_effective_date + context["previous_effective"] = previous_effective if previous_effective else "UNKNOWN" + context["previous_effective_english_suffix"] = format(previous_effective, "S") if previous_effective else None return context diff --git a/sponsors/tests/test_pdf.py b/sponsors/tests/test_pdf.py index 2116b7c21..e4d140cf2 100644 --- a/sponsors/tests/test_pdf.py +++ b/sponsors/tests/test_pdf.py @@ -30,6 +30,7 @@ def setUp(self): "legal_clauses": [], "renewal": None, "previous_effective": "UNKNOWN", + "previous_effective_english_suffix": None, } self.template = "sponsors/admin/preview-contract.html" @@ -90,6 +91,7 @@ def test_render_response_with_docx_attachment__renewal(self, MockDocxTemplate): "legal_clauses": [], "renewal": True, "previous_effective": "UNKNOWN", + "previous_effective_english_suffix": None, } renewal_template = "sponsors/admin/preview-contract.html"