1 # -*- coding: utf-8 -*-
 
   3 Generic app for creating contact forms.
 
   5 0. Add 'contact' to your INSTALLED_APPS and include 'contact.urls' somewhere
 
   8         include('contact.urls'))
 
  12 2. Create somewhere in your project a module with some subclasses of
 
  13 contact.forms.ContactForm, specyfing form_tag and some fields in each.
 
  15 3. Set CONTACT_FORMS_MODULE in your settings to point to the module.
 
  17 4. Link to the form with {% url 'contact_form' form_tag %}.
 
  19 5. Optionally override some templates in form-specific template directories
 
  20 (/contact/<form_tag>/...).
 
  22 6. Receive submitted forms by email and read them in admin.
 
  29     CONTACT_FORMS_MODULE = 'myproject.contact_forms'
 
  31 myproject/contact_forms.py:
 
  32     from django import forms
 
  33     from contact.forms import ContactForm
 
  34     from django.utils.translation import ugettext_lazy as _
 
  36     class RegistrationForm(ContactForm):
 
  38         name = forms.CharField(label=_('Name'), max_length=128)
 
  39         presentation = forms.FileField(label=_('Presentation'))
 
  42     {% url 'contact:form' 'register' %}
 
  46 from fnpdjango.utils.app import AppSettings
 
  49 class Settings(AppSettings):
 
  50     FORMS_MODULE = "contact_forms"
 
  53 app_settings = Settings('CONTACT')