sortowanie wyników uczniów w mailu dla nauczyciela
[edumed.git] / contact / __init__.py
1 """
2 Generic app for creating contact forms.
3
4 0. Add 'contact' to your INSTALLED_APPS and include 'contact.urls' somewhere
5 in your urls.py, like: 
6     url(r'^contact/', 
7         include('contact.urls'))
8
9 1. Migrate.
10
11 2. Create somewhere in your project a module with some subclasses of
12 contact.forms.ContactForm, specyfing form_tag and some fields in each.
13
14 3. Set CONTACT_FORMS_MODULE in your settings to point to the module.
15
16 4. Link to the form with {% url 'contact_form' form_tag %}.
17
18 5. Optionally override some templates in form-specific template directories
19 (/contact/<form_tag>/...).
20
21 6. Receive submitted forms by email and read them in admin.
22
23
24 Example:
25 ========
26
27 settings.py:
28     CONTACT_FORMS_MODULE = 'myproject.contact_forms'
29
30 myproject/contact_forms.py:
31     from django import forms
32     from contact.forms import ContactForm
33     from django.utils.translation import ugettext_lazy as _
34
35     class RegistrationForm(ContactForm):
36         form_tag = 'register'
37         name = forms.CharField(label=_('Name'), max_length=128)
38         presentation = forms.FileField(label=_('Presentation'))
39
40 some_template.html:
41     {% url 'contact:form' 'register' %}
42
43 """
44
45 from fnpdjango.utils.app import AppSettings
46
47
48 class Settings(AppSettings):
49     FORMS_MODULE = "contact_forms"
50
51
52 app_settings = Settings('CONTACT')