1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 Generic app for creating contact forms.
7 0. Add 'contact' to your INSTALLED_APPS and include 'contact.urls' somewhere
10 include('contact.urls'))
14 2. Create somewhere in your project a module with some subclasses of
15 contact.forms.ContactForm, specyfing form_tag and some fields in each.
17 3. Set CONTACT_FORMS_MODULE in your settings to point to the module.
19 4. Link to the form with {% url 'contact_form' form_tag %}.
21 5. Optionally override some templates in form-specific template directories
22 (/contact/<form_tag>/...).
24 6. Receive submitted forms by email and read them in admin.
31 CONTACT_FORMS_MODULE = 'myproject.contact_forms'
33 myproject/contact_forms.py:
34 from django import forms
35 from contact.forms import ContactForm
36 from django.utils.translation import ugettext_lazy as _
38 class RegistrationForm(ContactForm):
40 name = forms.CharField(label=_('Name'), max_length=128)
41 presentation = forms.FileField(label=_('Presentation'))
44 {% url 'contact:form' 'register' %}
48 from fnpdjango.utils.app import AppSettings
51 class Settings(AppSettings):
52 FORMS_MODULE = "contact_forms"
55 app_settings = Settings('CONTACT')