Merge pull request #1823 from cisagov/za/hotfix-fixtures-500-err

(Hotfix): Correct issue with Domain 500 error locally on fixtures
This commit is contained in:
zandercymatics 2024-02-23 11:03:44 -07:00 committed by GitHub
commit a8cf3d0563
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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: