diff --git a/publichealth/home/templates/tags/footer_form.html b/publichealth/home/templates/tags/footer_form.html index e7df2cf..a85c6d3 100644 --- a/publichealth/home/templates/tags/footer_form.html +++ b/publichealth/home/templates/tags/footer_form.html @@ -1,4 +1,5 @@ {% load wagtailcore_tags %} +{% if form %}
{% csrf_token %}
@@ -12,3 +13,4 @@
+{% endif %} diff --git a/publichealth/home/templatetags/information.py b/publichealth/home/templatetags/information.py index 2dee9ab..6bebdc1 100644 --- a/publichealth/home/templatetags/information.py +++ b/publichealth/home/templatetags/information.py @@ -17,9 +17,10 @@ def contact_info(): # Contact form (footer) @register.inclusion_tag('tags/footer_form.html') def footer_form(): - return { - 'form': Contact.objects.last().contact_form, - } + if Contact.objects.last(): + return { + 'form': Contact.objects.last().contact_form, + } # Contact links (header) @register.inclusion_tag('tags/contact_links.html')