From 06395077c91fadfee436a9c1f1c069e89bee34e7 Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Mon, 18 Nov 2024 13:24:14 -0800 Subject: [PATCH] Returning none if no donate banner is set (#13133) --- network-api/networkapi/wagtailpages/pagemodels/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/network-api/networkapi/wagtailpages/pagemodels/base.py b/network-api/networkapi/wagtailpages/pagemodels/base.py index 8df70d0910..ef2ba8d126 100644 --- a/network-api/networkapi/wagtailpages/pagemodels/base.py +++ b/network-api/networkapi/wagtailpages/pagemodels/base.py @@ -41,7 +41,8 @@ def get_donate_banner(self, request): default_locale = Locale.get_default() donate_banner_page = DonateBannerPage.objects.filter(locale=default_locale).first() - if not donate_banner_page: + # If there is no DonateBannerPage or no donate_banner is set, return None. + if not donate_banner_page or not donate_banner_page.donate_banner: return None # Check if the user has Do Not Track enabled by inspecting the DNT header.