enquiry
Note
The enquiry
app will send emails to the list of users set-up in
the notify list in admin.
Install
Install Captcha
Add the mail app to your project.
Add the enquiry app to requirements/local.txt
:
-e ../../app/enquiry
Add the enquiry app to requirements/production.txt
.
Add the enquiry app to settings/base.py
:
LOCAL_APPS = (
'project',
# ...
'enquiry',
Add the enquiry app to project/urls.py
:
urlpatterns = [
# ...
url(regex=r"^enquiry/", view=include("enquiry.urls")),
Issues
Initialise
If you get the following error:
"GdprError, Consent 'enquiry-app-contact' does not exist"
Then initialise the enquiry
app e.g:
django-admin init-app-enquiry
Usage
Note
The following instructions are for adding an enquiry form to a custom page (using our block app).
Create a custom page for the enquiry form (probably best to do this in the
init_project
management command for your project):
project/management/commands/init_project.py
Note
This example is for use in a management command.
(it uses page sections from the compose
app)
Create a URL for your custom page:
from web.views import EnquiryCreateView
url(
regex=r"^contact/$",
view=EnquiryCreateView.as_view(),
kwargs=dict(page=Page.CUSTOM, menu="contact"),
name="web.contact",
),
In your view, inherit from EnquiryCreateMixin
e.g: web/views.py
Note
To add a notice to your form (which can include HTML), see GDPR
Add the enquiry form to your template e.g: compose/templates/compose/contact.html
In the base template for your project, add a link to your enquiry view e.g: web/templates/web/base.html
{% block menu_extra %}
{{ block.super }}
<li class="pure-menu-item{% if 'contact' in path %} pure-menu-selected{% endif %}">
<a href="{% url 'web.contact' %}" class="pure-menu-link">
Contact Us
</a>
</li>
{# use an exact match on the path if you want to add a design menu #}
{% if path == '/contact/' or path == '/custom/contact/design/' %}
{% include 'block/_design_menu.html' %}
{% endif %}
{% endblock menu_extra %}
Tip
If you don’t add the design menu, you can edit the content of the enquiry page, using Settings, Pages, Config…
Note
The enquiry page will not be included in the CMS Pages or the Navigation Menu because it is a custom page.
Set-up
Log into the admin area of the site and set-up notify users.