Installation¶
You can install django-contactform with pip
pip install django-contactform
Requirements¶
messages framework
Ensure the Django messages framework is enabled on your project https://docs.djangoproject.com/en/3.0/ref/contrib/messages/
Enable the app¶
- Add ‘contactform’ to your INSTALLED_APPS settings
INSTALLED_APPS = [
...
'contactform',
]
- Configure the recipients of your form in your settings
CONTACTFORM_RECIPIENTS = ['me@example.com']
- Include the contactform URLconf in your project urls.py like
path('contact/', include('contactform.urls')),
- Add a form to an existing page using the contact_form template tag
{% load contact_form %}
{% contact_form %}
or add a link to the contact page
<a href="{% url 'contactform:index' %}">Contact us</a>