Skip to main content

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

Requires

Django >= 1.4

Installation

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>

Templates

contact/form.html:

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

contact/success.html:

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

contact/email.txt:

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

{{ message }}

---
This message was sent via the website contact form.

Settings

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_EMAILS

Yes

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

Metadata

Release files for quix.django.contact 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quix.django.contact 0.2.1
File Size Uploaded Provenance
quix.django.contact-0.2.1.tar.gz 8.1 kB Without provenance Details

Release files / quix.django.contact-0.2.1.tar.gz

Download URL quix.django.contact-0.2.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
df6c20598496d60f5f8668f2410ac7197465d0b46b8338fe217885fb73a2b673
BLAKE2b-256 checksum
How to use checksums
fdf4887d53372f7b8eb77344b22d9f697831db3ccfa23e2b7598f3e2e311c0fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for quix.django.contact 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page