Contact-form is placed footer. And most of the different views has footer section.
def about-page(request):
return render(request, 'about.html')
def faq-page(request):
return render(request, 'faq.html')
def home-page(request):
return render(request, 'home.html')
All above template have "included" footer section:
{% include 'footer.html' %}
And this has further included contact-form:
{% include 'contact.html' %}
So, now if I want to render contact form on all pages, I have to pass it in context. Like:
def about-page(request):
form = ContactForm()
return render(request, 'about.html',{'form':form})
def faq-page(request):
form = ContactForm()
return render(request, 'faq.html',{'form':form})
def home-page(request):
form = ContactForm()
return render(request, 'homeabout.html',{'form':form})
Is there any universal function I can do to add form to all pages by not repeating. Because I have way to many pages in whole site.