From ec44f8fe58e32390d1f580723abd2dc1a1cb083b Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:45:54 -0700 Subject: [PATCH] Update admin.py --- src/registrar/admin.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/registrar/admin.py b/src/registrar/admin.py index cdd8611f0..0ab6c3022 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -1159,7 +1159,14 @@ class DomainAdmin(ListHeaderAdmin): if object_id is not None: domain = Domain.objects.get(pk=object_id) years_to_extend_by = self._get_calculated_years_for_exp_date(domain) - curr_exp_date = domain.registry_expiration_date + + try: + curr_exp_date = domain.registry_expiration_date + except KeyError: + # No expiration date was found. Return none. + extra_context["extended_expiration_date"] = None + return super().changeform_view(request, object_id, form_url, extra_context) + if curr_exp_date < date.today(): extra_context["extended_expiration_date"] = date.today() + relativedelta(years=years_to_extend_by) else: