A very simple contact form for a Django website.
Failed to load latest commit information.
quix Concatenation works for exception now--really, I promise. Nov 21, 2012
.gitignore Initial commit Sep 21, 2012
LICENSE Initial commit Sep 21, 2012
README.rst Modified README Nov 22, 2012
distribute_setup.py Initial commit Sep 21, 2012
setup.py Initial commit Sep 21, 2012


Django Contact Form

A very simple contact form for a Django website. The form is emailed to one or more email addresses upon submission.


Django >= 1.4


Install the latest release using pip:

pip install quix.django.contact

Or install the development version using git:

git clone https://github.com/Quixotix/quix.django.contact.git

Add quix.django.contact to INSTALLED_APPS in settings.py.

Basic Usage

Specify the email addresses which will recieve the contact form message in settings.py:

CONTACT_EMAILS = ('somebody@localhost', 'another@localhost')

Include quix.django.contact.urls in urls.py:

urlpatterns = patterns('',
    # ...
    url(r'^contact/', include('quix.django.contact.urls')),
    # ...

Create the 3 templates (see examples in the next section):

  • contact/form.html - The contact form with form in the context.
  • contact/success.html - Page the form redirects to when successful.
  • contact/email.txt - The text template for the email.

Link to the contact form in a template using the "contact-form" named URL pattern:

<a href="{% url contact-form %}">Contact</a>



{% extends "base.html" %}
{% block content %}
  <form action="." method="post">
    {% csrf_token %}
    {{ form.non_field_errors }}
    {{ form.as_p }}
    <input type="submit" value="Send" />
{% endblock %}


{% extends "base.html" %}
{% block content %}
  <h1>Your message has been sent.</h1>
{% endblock %}


From: {{ name }} {{ email }}

{{ message }}

This message was sent via the website contact form.


The following settings can be set in settings.py for the contact form. Only CONTACT_EMAILS is required, which is a tuple or list of email addresses to which the contact form should be sent.

Setting Default Required
CONTACT_FORM_CLASS "quix.django.contact.forms.ContactForm" No
CONTACT_FORM_TEMPLATE "contact/form.html" No
CONTACT_SUCCESS_TEMPLATE "contact/success.html" No
CONTACT_EMAIL_TEMPLATE "contact/email.txt" No