[Python-modules-commits] [python-django-contact-form] 02/14: Import python-django-contact-form_1.1.orig.tar.gz
Andrew Starr-Bochicchio
asb at moszumanska.debian.org
Sun Oct 11 18:25:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
asb pushed a commit to branch master
in repository python-django-contact-form.
commit 051cb7d03e5982de809187e9a53c1451eaeb4ec3
Author: Andrew Starr-Bochicchio <a.starr.b at gmail.com>
Date: Sun Oct 11 12:54:47 2015 -0400
Import python-django-contact-form_1.1.orig.tar.gz
---
MANIFEST.in | 2 +-
PKG-INFO | 9 +-
README => README.rst | 0
contact_form/forms.py | 161 +++------------
contact_form/models.py | 3 +
contact_form/runtests.py | 64 ++++++
contact_form/tests/__init__.py | 2 -
contact_form/tests/forms.py | 71 -------
contact_form/tests/test_forms.py | 142 +++++++++++++
contact_form/tests/test_urls.py | 25 +++
contact_form/tests/{views.py => test_views.py} | 51 +++--
contact_form/urls.py | 20 +-
contact_form/views.py | 6 +
PKG-INFO => django_contact_form.egg-info/PKG-INFO | 9 +-
django_contact_form.egg-info/SOURCES.txt | 27 +++
django_contact_form.egg-info/dependency_links.txt | 1 +
django_contact_form.egg-info/not-zip-safe | 1 +
django_contact_form.egg-info/top_level.txt | 1 +
docs/conf.py | 237 +---------------------
docs/faq.rst | 34 ++--
docs/forms.rst | 13 +-
docs/index.rst | 4 +-
docs/install.rst | 151 ++++++++++++++
docs/quickstart.rst | 183 -----------------
docs/views.rst | 55 ++++-
setup.cfg | 5 +
setup.py | 17 +-
27 files changed, 614 insertions(+), 680 deletions(-)
diff --git a/MANIFEST.in b/MANIFEST.in
index d639392..93e2657 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
include LICENSE
-include README
include MANIFEST.in
+include README.rst
recursive-include docs *
\ No newline at end of file
diff --git a/PKG-INFO b/PKG-INFO
index b97eaf1..a6d3a08 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: django-contact-form
-Version: 1.0
+Version: 1.1
Summary: Generic contact-form application for Django
-Home-page: https://bitbucket.org/ubernostrum/django-contact-form/
+Home-page: https://github.com/ubernostrum/django-contact-form/
Author: James Bennett
Author-email: james at b-list.org
License: UNKNOWN
-Download-URL: http://bitbucket.org/ubernostrum/django-contact-form/downloads/django-contact-form-1.0.tar.gz
Description: .. -*-restructuredtext-*-
This application provids simple, extensible contact-form functionality
@@ -18,13 +17,15 @@ Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.7
+Classifier: Framework :: Django :: 1.8
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Utilities
diff --git a/README b/README.rst
similarity index 100%
rename from README
rename to README.rst
diff --git a/contact_form/forms.py b/contact_form/forms.py
index 46a55ab..de69edc 100644
--- a/contact_form/forms.py
+++ b/contact_form/forms.py
@@ -1,10 +1,9 @@
"""
A base contact form for allowing users to send email messages through
-a web interface, and a subclass demonstrating useful functionality.
+a web interface.
"""
-
from django import forms
from django.conf import settings
from django.core.mail import send_mail
@@ -19,137 +18,36 @@ class ContactForm(forms.Form):
The base contact form class from which all contact form classes
should inherit.
- If you don't need any custom functionality, you can simply use
- this form to provide basic contact functionality; it will collect
- name, email address and message.
-
- The ``ContactForm`` view included in this application knows how to
- work with this form and can handle many types of subclasses as
- well (see below for a discussion of the important points), so in
- many cases it will be all that you need. If you'd like to use this
- form or a subclass of it from one of your own views, just do the
- following:
-
- 1. When you instantiate the form, pass the current ``HttpRequest``
- object to the constructor as the keyword argument ``request``;
- this is used internally by the base implementation, and also
- made available so that subclasses can add functionality which
- relies on inspecting the request.
-
- 2. To send the message, call the form's ``save`` method, which
- accepts the keyword argument ``fail_silently`` and defaults it
- to ``False``. This argument is passed directly to
- ``send_mail``, and allows you to suppress or raise exceptions
- as needed for debugging. The ``save`` method has no return
- value.
-
- Other than that, treat it like any other form; validity checks and
- validated data are handled normally, through the ``is_valid``
- method and the ``cleaned_data`` dictionary.
-
-
- Base implementation
- -------------------
-
- Under the hood, this form uses a somewhat abstracted interface in
- order to make it easier to subclass and add functionality. There
- are several important attributes subclasses may want to look at
- overriding, all of which will work (in the base implementation) as
- either plain attributes or as callable methods:
-
- * ``from_email`` -- used to get the address to use in the
- ``From:`` header of the message. The base implementation returns
- the value of the ``DEFAULT_FROM_EMAIL`` setting.
-
- * ``message`` -- used to get the message body as a string. The
- base implementation renders a template using the form's
- ``cleaned_data`` dictionary as context.
-
- * ``recipient_list`` -- used to generate the list of recipients
- for the message. The base implementation returns the email
- addresses specified in the ``MANAGERS`` setting.
-
- * ``subject`` -- used to generate the subject line for the
- message. The base implementation returns the string 'Message
- sent through the web site', with the name of the current
- ``Site`` prepended.
-
- * ``template_name`` -- used by the base ``message`` method to
- determine which template to use for rendering the
- message. Default is ``contact_form/contact_form.txt``.
-
- Internally, the base implementation ``_get_message_dict`` method
- collects ``from_email``, ``message``, ``recipient_list`` and
- ``subject`` into a dictionary, which the ``save`` method then
- passes directly to ``send_mail`` as keyword arguments.
-
- Particularly important is the ``message`` attribute, with its base
- implementation as a method which renders a template; because it
- passes ``cleaned_data`` as the template context, any additional
- fields added by a subclass will automatically be available in the
- template. This means that many useful subclasses can get by with
- just adding a few fields and possibly overriding
- ``template_name``.
-
- Much useful functionality can be achieved in subclasses without
- having to override much of the above; adding additional validation
- methods works the same as any other form, and typically only a few
- items -- ``recipient_list`` and ``subject_line``, for example,
- need to be overridden to achieve customized behavior.
-
-
- Other notes for subclassing
- ---------------------------
-
- Subclasses which want to inspect the current ``HttpRequest`` to
- add functionality can access it via the attribute ``request``; the
- base ``message`` takes advantage of this to use ``RequestContext``
- when rendering its template. See the ``AkismetContactForm``
- subclass in this file for an example of using the request to
- perform additional validation.
-
- Subclasses which override ``__init__`` need to accept ``*args``
- and ``**kwargs``, and pass them via ``super`` in order to ensure
- proper behavior.
-
- Subclasses should be careful if overriding ``_get_message_dict``,
- since that method **must** return a dictionary suitable for
- passing directly to ``send_mail`` (unless ``save`` is overridden
- as well).
-
- Overriding ``save`` is relatively safe, though remember that code
- which uses your form will expect ``save`` to accept the
- ``fail_silently`` keyword argument. In the base implementation,
- that argument defaults to ``False``, on the assumption that it's
- far better to notice errors than to silently not send mail from
- the contact form.
-
"""
- def __init__(self, data=None, files=None, request=None, *args, **kwargs):
- if request is None:
- raise TypeError("Keyword argument 'request' must be supplied")
- super(ContactForm, self).__init__(data=data, files=files, *args, **kwargs)
- self.request = request
-
name = forms.CharField(max_length=100,
label=u'Your name')
email = forms.EmailField(max_length=200,
label=u'Your email address')
body = forms.CharField(widget=forms.Textarea,
- label=u'Your message')
-
+ label=u'Your message')
+
from_email = settings.DEFAULT_FROM_EMAIL
-
+
recipient_list = [mail_tuple[1] for mail_tuple in settings.MANAGERS]
subject_template_name = "contact_form/contact_form_subject.txt"
-
+
template_name = 'contact_form/contact_form.txt'
+ def __init__(self, data=None, files=None, request=None,
+ recipient_list=None, *args, **kwargs):
+ if request is None:
+ raise TypeError("Keyword argument 'request' must be supplied")
+ self.request = request
+ if recipient_list is not None:
+ self.recipient_list = recipient_list
+ super(ContactForm, self).__init__(data=data, files=files,
+ *args, **kwargs)
+
def message(self):
"""
Render the body of the message to a string.
-
+
"""
if callable(self.template_name):
template_name = self.template_name()
@@ -157,16 +55,16 @@ class ContactForm(forms.Form):
template_name = self.template_name
return loader.render_to_string(template_name,
self.get_context())
-
+
def subject(self):
"""
Render the subject of the message to a string.
-
+
"""
subject = loader.render_to_string(self.subject_template_name,
self.get_context())
return ''.join(subject.splitlines())
-
+
def get_context(self):
"""
Return the context used to render the templates for the email
@@ -181,10 +79,12 @@ class ContactForm(forms.Form):
* Any additional variables added by context processors (this
will be a ``RequestContext``).
-
+
"""
if not self.is_valid():
- raise ValueError("Cannot generate Context from invalid contact form")
+ raise ValueError(
+ "Cannot generate Context from invalid contact form"
+ )
if Site._meta.installed:
site = Site.objects.get_current()
else:
@@ -192,7 +92,7 @@ class ContactForm(forms.Form):
return RequestContext(self.request,
dict(self.cleaned_data,
site=site))
-
+
def get_message_dict(self):
"""
Generate the various parts of the message and return them in a
@@ -208,19 +108,22 @@ class ContactForm(forms.Form):
* ``recipient_list``
* ``subject``
-
+
"""
if not self.is_valid():
- raise ValueError("Message cannot be sent from invalid contact form")
+ raise ValueError(
+ "Message cannot be sent from invalid contact form"
+ )
message_dict = {}
- for message_part in ('from_email', 'message', 'recipient_list', 'subject'):
+ for message_part in ('from_email', 'message',
+ 'recipient_list', 'subject'):
attr = getattr(self, message_part)
message_dict[message_part] = attr() if callable(attr) else attr
return message_dict
-
+
def save(self, fail_silently=False):
"""
Build and send the email message.
-
+
"""
send_mail(fail_silently=fail_silently, **self.get_message_dict())
diff --git a/contact_form/models.py b/contact_form/models.py
index e69de29..815b221 100644
--- a/contact_form/models.py
+++ b/contact_form/models.py
@@ -0,0 +1,3 @@
+# This application provides no models, but some versions of Django
+# require a models.py to exist in order to run tests in the
+# application.
diff --git a/contact_form/runtests.py b/contact_form/runtests.py
new file mode 100644
index 0000000..372356b
--- /dev/null
+++ b/contact_form/runtests.py
@@ -0,0 +1,64 @@
+"""
+A standalone test runner script, configuring the minimum settings
+required for django-contact-form' tests to execute.
+
+Re-use at your own risk: many Django applications will require full
+settings and/or templates in order to execute their tests, while
+django-contact-form does not.
+
+"""
+
+import os
+import sys
+
+
+# Make sure django-contact-form is (at least temporarily) on the
+# import path.
+CONTACT_FORM_DIR = os.path.abspath(os.path.dirname(__file__))
+sys.path.insert(0, CONTACT_FORM_DIR)
+
+
+# Minimum settings required for django-contact-form to work.
+SETTINGS_DICT = {
+ 'BASE_DIR': CONTACT_FORM_DIR,
+ 'INSTALLED_APPS': ('contact_form', 'django.contrib.sites'),
+ 'ROOT_URLCONF': 'contact_form.tests.urls',
+ 'DATABASES': {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(CONTACT_FORM_DIR, 'db.sqlite3'),
+ },
+ },
+ 'MIDDLEWARE_CLASSES': (
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ ),
+ 'TEMPLATE_DIRS': (
+ os.path.join(CONTACT_FORM_DIR, 'tests/templates'),
+ ),
+ 'SITE_ID': 1,
+ 'DEFAULT_FROM_EMAIL': 'contact at example.com',
+ 'MANAGERS': [('Manager', 'noreply at example.com')],
+}
+
+
+def run_tests():
+ # Making Django run this way is a two-step process. First, call
+ # settings.configure() to give Django settings to work with:
+ from django.conf import settings
+ settings.configure(**SETTINGS_DICT)
+
+ # Then, call django.setup() to initialize the application cache
+ # and other bits:
+ import django
+ if hasattr(django, 'setup'):
+ django.setup()
+
+ # Now we instantiate a test runner...
+ from django.test.utils import get_runner
+ TestRunner = get_runner(settings)
+
+ # And then we run tests and return the results.
+ test_runner = TestRunner(verbosity=1, interactive=True)
+ failures = test_runner.run_tests(['contact_form.tests'])
+ sys.exit(bool(failures))
diff --git a/contact_form/tests/__init__.py b/contact_form/tests/__init__.py
index 633516d..e69de29 100644
--- a/contact_form/tests/__init__.py
+++ b/contact_form/tests/__init__.py
@@ -1,2 +0,0 @@
-from .forms import *
-from .views import *
diff --git a/contact_form/tests/forms.py b/contact_form/tests/forms.py
deleted file mode 100644
index b06a639..0000000
--- a/contact_form/tests/forms.py
+++ /dev/null
@@ -1,71 +0,0 @@
-from django.conf import settings
-from django.core import mail
-from django.test import RequestFactory
-from django.test import TestCase
-
-from django.contrib.sites.models import Site
-
-from contact_form.forms import ContactForm
-
-
-class ContactFormTests(TestCase):
- def test_request_required(self):
- """
- Can't instantiate without an HttpRequest.
-
- """
- self.assertRaises(TypeError, ContactForm)
-
- def test_valid_data_required(self):
- """
- Can't try to build the message dict unless data is valid.
-
- """
- request = RequestFactory().request()
- data = {'name': 'Test',
- 'body': 'Test message'}
- form = ContactForm(request=request, data=data)
- self.assertRaises(ValueError, form.get_message_dict)
-
- def test_send(self):
- """
- Valid form can and does in fact send email.
-
- """
- request = RequestFactory().request()
- data = {'name': 'Test',
- 'email': 'test at example.com',
- 'body': 'Test message'}
- form = ContactForm(request=request, data=data)
- self.assertTrue(form.is_valid())
-
- form.save()
- self.assertEqual(1, len(mail.outbox))
-
- message = mail.outbox[0]
- self.assertEqual([data['email']],
- message.recipients())
- self.assertTrue(data['body'] in message.body)
- self.assertEqual(settings.DEFAULT_FROM_EMAIL,
- message.from_email)
-
- def test_no_sites(self):
- """
- Sites integration works with or without installed
- contrib.sites.
-
- """
- old_installed = Site._meta.installed
- Site._meta.installed = False
-
- request = RequestFactory().request()
- data = {'name': 'Test',
- 'email': 'test at example.com',
- 'body': 'Test message'}
- form = ContactForm(request=request, data=data)
- self.assertTrue(form.is_valid())
-
- form.save()
- self.assertEqual(1, len(mail.outbox))
-
- Site._meta.installed = old_installed
diff --git a/contact_form/tests/test_forms.py b/contact_form/tests/test_forms.py
new file mode 100644
index 0000000..0491d58
--- /dev/null
+++ b/contact_form/tests/test_forms.py
@@ -0,0 +1,142 @@
+from django.conf import settings
+from django.core import mail
+from django.test import RequestFactory
+from django.test import TestCase
+
+from ..forms import ContactForm
+
+
+class ContactFormTests(TestCase):
+ valid_data = {'name': 'Test',
+ 'email': 'test at example.com',
+ 'body': 'Test message'}
+
+ def request(self):
+ return RequestFactory().request()
+
+ def test_request_required(self):
+ """
+ Can't instantiate without an HttpRequest.
+
+ """
+ self.assertRaises(TypeError, ContactForm)
+
+ def test_valid_data_required(self):
+ """
+ Can't try to build the message dict unless data is valid.
+
+ """
+ data = {'name': 'Test',
+ 'body': 'Test message'}
+ form = ContactForm(request=self.request(), data=data)
+ self.assertRaises(ValueError, form.get_message_dict)
+ self.assertRaises(ValueError, form.get_context)
+
+ def test_send(self):
+ """
+ Valid form can and does in fact send email.
+
+ """
+ form = ContactForm(request=self.request(),
+ data=self.valid_data)
+ self.assertTrue(form.is_valid())
+
+ form.save()
+ self.assertEqual(1, len(mail.outbox))
+
+ message = mail.outbox[0]
+ self.assertTrue(self.valid_data['body'] in message.body)
+ self.assertEqual(settings.DEFAULT_FROM_EMAIL,
+ message.from_email)
+ self.assertEqual(form.recipient_list,
+ message.recipients())
+
+ def test_no_sites(self):
+ """
+ Sites integration works with or without installed
+ contrib.sites.
+
+ """
+ with self.modify_settings(
+ INSTALLED_APPS={
+ 'remove': ['django.contrib.sites'],
+ }):
+ form = ContactForm(request=self.request(),
+ data=self.valid_data)
+ self.assertTrue(form.is_valid())
+
+ form.save()
+ self.assertEqual(1, len(mail.outbox))
+
+ def test_recipient_list(self):
+ """
+ Passing recipient_list when instantiating ContactForm properly
+ overrides the list of recipients.
+
+ """
+ recipient_list = ['recipient_list at example.com']
+ form = ContactForm(request=self.request(),
+ data=self.valid_data,
+ recipient_list=recipient_list)
+ self.assertTrue(form.is_valid())
+
+ form.save()
+ self.assertEqual(1, len(mail.outbox))
+
+ message = mail.outbox[0]
+ self.assertEqual(recipient_list,
+ message.recipients())
+
+ def test_callable_template_name(self):
+ """
+ When a template_name() method is defined, it is used and
+ preferred over a 'template_name' attribute.
+
+ """
+ class CallableTemplateName(ContactForm):
+ def template_name(self):
+ return 'contact_form/test_callable_template_name.html'
+
+ form = CallableTemplateName(request=self.request(),
+ data=self.valid_data)
+ self.assertTrue(form.is_valid())
+
+ form.save()
+ self.assertEqual(1, len(mail.outbox))
+
+ message = mail.outbox[0]
+ self.assertTrue('Callable template_name used.' in
+ message.body)
+
+ def test_callable_message_parts(self):
+ """
+ Message parts implemented as methods are called and preferred
+ over attributes.
+
+ """
+ overridden_data = {
+ 'from_email': 'override at example.com',
+ 'message': 'Overridden message.',
+ 'recipient_list': ['override_recpt at example.com'],
+ 'subject': 'Overridden subject',
+ }
+
+ class CallableMessageParts(ContactForm):
+ def from_email(self):
+ return overridden_data['from_email']
+
+ def message(self):
+ return overridden_data['message']
+
+ def recipient_list(self):
+ return overridden_data['recipient_list']
+
+ def subject(self):
+ return overridden_data['subject']
+
+ form = CallableMessageParts(request=self.request(),
+ data=self.valid_data)
+ self.assertTrue(form.is_valid())
+
+ self.assertEqual(overridden_data,
+ form.get_message_dict())
diff --git a/contact_form/tests/test_urls.py b/contact_form/tests/test_urls.py
new file mode 100644
index 0000000..19b4289
--- /dev/null
+++ b/contact_form/tests/test_urls.py
@@ -0,0 +1,25 @@
+"""
+URLConf for testing django-contact-form.
+
+"""
+
+from django.conf.urls import url
+from django.views.generic import TemplateView
+
+from ..views import ContactFormView
+
+
+urlpatterns = [
+ url(r'^$',
+ ContactFormView.as_view(),
+ name='contact_form'),
+ url(r'^sent/$',
+ TemplateView.as_view(
+ template_name='contact_form/contact_form_sent.html'
+ ),
+ name='contact_form_sent'),
+ url(r'^test_recipient_list/$',
+ ContactFormView.as_view(
+ recipient_list=['recipient_list at example.com']),
+ name='test_recipient_list'),
+]
diff --git a/contact_form/tests/views.py b/contact_form/tests/test_views.py
similarity index 63%
rename from contact_form/tests/views.py
rename to contact_form/tests/test_views.py
index 1c46f59..5860865 100644
--- a/contact_form/tests/views.py
+++ b/contact_form/tests/test_views.py
@@ -1,37 +1,39 @@
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
+from django.test import RequestFactory
from django.test import TestCase
+from ..forms import ContactForm
-class ViewTests(TestCase):
- urls = 'contact_form.urls'
+
+class ContactFormViewTests(TestCase):
+ urls = 'contact_form.tests.test_urls'
def test_get(self):
"""
HTTP GET on the form view just shows the form.
-
+
"""
contact_url = reverse('contact_form')
-
+
response = self.client.get(contact_url)
self.assertEqual(200, response.status_code)
self.assertTemplateUsed(response,
'contact_form/contact_form.html')
-
-
+
def test_send(self):
"""
Valid data through the view results in a successful send.
-
+
"""
contact_url = reverse('contact_form')
data = {'name': 'Test',
'email': 'test at example.com',
'body': 'Test message'}
-
+
response = self.client.post(contact_url,
- data=data)
+ data=data)
self.assertRedirects(response,
reverse('contact_form_sent'))
@@ -39,22 +41,22 @@ class ViewTests(TestCase):
self.assertEqual(1, len(mail.outbox))
message = mail.outbox[0]
- self.assertEqual([data['email']],
- message.recipients())
self.assertTrue(data['body'] in message.body)
self.assertEqual(settings.DEFAULT_FROM_EMAIL,
message.from_email)
-
+ form = ContactForm(request=RequestFactory().request)
+ self.assertEqual(form.recipient_list,
+ message.recipients())
def test_invalid(self):
"""
Invalid data doesn't work.
-
+
"""
contact_url = reverse('contact_form')
data = {'name': 'Test',
'body': 'Test message'}
-
+
response = self.client.post(contact_url,
data=data)
@@ -64,3 +66,24 @@ class ViewTests(TestCase):
'email',
'This field is required.')
self.assertEqual(0, len(mail.outbox))
+
+ def test_recipient_list(self):
+ """
+ Passing recipient_list when instantiating ContactFormView
+ properly overrides the list of recipients.
+
+ """
+ contact_url = reverse('test_recipient_list')
+ data = {'name': 'Test',
+ 'email': 'test at example.com',
+ 'body': 'Test message'}
+
+ response = self.client.post(contact_url,
+ data=data)
+ self.assertRedirects(response,
+ reverse('contact_form_sent'))
+ self.assertEqual(1, len(mail.outbox))
+
+ message = mail.outbox[0]
+ self.assertEqual(['recipient_list at example.com'],
+ message.recipients())
diff --git a/contact_form/urls.py b/contact_form/urls.py
index d783d33..e925044 100644
--- a/contact_form/urls.py
+++ b/contact_form/urls.py
@@ -7,20 +7,18 @@ include this URLConf somewhere in your URL hierarchy (for example, at
"""
-from django.conf.urls import patterns
from django.conf.urls import url
from django.views.generic import TemplateView
from contact_form.views import ContactFormView
-urlpatterns = patterns('',
- url(r'^$',
- ContactFormView.as_view(),
- name='contact_form'),
- url(r'^sent/$',
- TemplateView.as_view(
- template_name='contact_form/contact_form_sent.html'
- ),
- name='contact_form_sent'),
- )
+urlpatterns = [
+ url(r'^$',
+ ContactFormView.as_view(),
+ name='contact_form'),
+ url(r'^sent/$',
+ TemplateView.as_view(
+ template_name='contact_form/contact_form_sent.html'),
+ name='contact_form_sent'),
+]
diff --git a/contact_form/views.py b/contact_form/views.py
index d6bf68c..ed08613 100644
--- a/contact_form/views.py
+++ b/contact_form/views.py
@@ -11,6 +11,7 @@ from .forms import ContactForm
class ContactFormView(FormView):
form_class = ContactForm
+ recipient_list = None
template_name = 'contact_form/contact_form.html'
def form_valid(self, form):
@@ -22,6 +23,11 @@ class ContactFormView(FormView):
# HttpRequest.
kwargs = super(ContactFormView, self).get_form_kwargs()
kwargs.update({'request': self.request})
+
+ # We may also have been given a recipient list when
+ # instantiated.
+ if self.recipient_list is not None:
+ kwargs.update({'recipient_list': self.recipient_list})
return kwargs
def get_success_url(self):
diff --git a/PKG-INFO b/django_contact_form.egg-info/PKG-INFO
similarity index 81%
copy from PKG-INFO
copy to django_contact_form.egg-info/PKG-INFO
index b97eaf1..a6d3a08 100644
--- a/PKG-INFO
+++ b/django_contact_form.egg-info/PKG-INFO
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: django-contact-form
-Version: 1.0
+Version: 1.1
Summary: Generic contact-form application for Django
-Home-page: https://bitbucket.org/ubernostrum/django-contact-form/
+Home-page: https://github.com/ubernostrum/django-contact-form/
Author: James Bennett
Author-email: james at b-list.org
License: UNKNOWN
-Download-URL: http://bitbucket.org/ubernostrum/django-contact-form/downloads/django-contact-form-1.0.tar.gz
Description: .. -*-restructuredtext-*-
This application provids simple, extensible contact-form functionality
@@ -18,13 +17,15 @@ Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.7
+Classifier: Framework :: Django :: 1.8
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Utilities
diff --git a/django_contact_form.egg-info/SOURCES.txt b/django_contact_form.egg-info/SOURCES.txt
new file mode 100644
index 0000000..22e3603
--- /dev/null
+++ b/django_contact_form.egg-info/SOURCES.txt
@@ -0,0 +1,27 @@
+LICENSE
+MANIFEST.in
+README.rst
+setup.py
+contact_form/__init__.py
+contact_form/forms.py
+contact_form/models.py
+contact_form/runtests.py
+contact_form/urls.py
+contact_form/views.py
+contact_form/tests/__init__.py
+contact_form/tests/test_forms.py
+contact_form/tests/test_urls.py
+contact_form/tests/test_views.py
+django_contact_form.egg-info/PKG-INFO
+django_contact_form.egg-info/SOURCES.txt
+django_contact_form.egg-info/dependency_links.txt
+django_contact_form.egg-info/not-zip-safe
+django_contact_form.egg-info/top_level.txt
+docs/Makefile
+docs/conf.py
+docs/faq.rst
+docs/forms.rst
+docs/index.rst
+docs/install.rst
+docs/make.bat
+docs/views.rst
\ No newline at end of file
diff --git a/django_contact_form.egg-info/dependency_links.txt b/django_contact_form.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/django_contact_form.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/django_contact_form.egg-info/not-zip-safe b/django_contact_form.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/django_contact_form.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/django_contact_form.egg-info/top_level.txt b/django_contact_form.egg-info/top_level.txt
new file mode 100644
index 0000000..f78a63b
--- /dev/null
+++ b/django_contact_form.egg-info/top_level.txt
@@ -0,0 +1 @@
+contact_form
diff --git a/docs/conf.py b/docs/conf.py
index bccacf0..96297f8 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,242 +1,25 @@
-# -*- coding: utf-8 -*-
-#
-# django-contact-form documentation build configuration file, created by
-# sphinx-quickstart on Tue Aug 20 10:50:38 2013.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
+import os
-import sys, os
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
-
-# -- General configuration -----------------------------------------------------
-
-# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
-
-# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
-
-# The suffix of source filenames.
source_suffix = '.rst'
-
-# The encoding of source files.
-#source_encoding = 'utf-8-sig'
-
-# The master toctree document.
master_doc = 'index'
-
-# General information about the project.
project = u'django-contact-form'
-copyright = u'2013, James Bennett'
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = '1.0'
-# The full version, including alpha/beta/rc tags.
-release = '1.0'
-
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-#language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-#today = ''
-# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
-
... 780 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django-contact-form.git
More information about the Python-modules-commits
mailing list