None condition

This commit is contained in:
Oleg Lavrovsky 2017-05-15 22:38:41 +02:00
parent 2d5b61b0ec
commit 452ccc3f93
2 changed files with 6 additions and 3 deletions

View file

@ -1,4 +1,5 @@
{% load wagtailcore_tags %}
{% if form %}
<form action="{% pageurl form %}" method="POST">
{% csrf_token %}
<div class="form-group">
@ -12,3 +13,4 @@
</div>
<button class="btn btn-primary" type="submit">Senden / Envoi</button>
</form>
{% endif %}

View file

@ -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')