X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6d42bc478e3d1bd90eb294464748c21e4de0fc63..243ac5a586da9e5abb87698306794b6cc173ded1:/src/contact/__init__.py?ds=sidebyside diff --git a/src/contact/__init__.py b/src/contact/__init__.py index bbf0f3d80..e69de29bb 100644 --- a/src/contact/__init__.py +++ b/src/contact/__init__.py @@ -1,55 +0,0 @@ -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -""" -Generic app for creating contact forms. - -0. Add 'contact' to your INSTALLED_APPS and include 'contact.urls' somewhere -in your urls.py, like: - url(r'^contact/', - include('contact.urls')) - -1. Migrate. - -2. Create somewhere in your project a module with some subclasses of -contact.forms.ContactForm, specyfing form_tag and some fields in each. - -3. Set CONTACT_FORMS_MODULE in your settings to point to the module. - -4. Link to the form with {% url 'contact_form' form_tag %}. - -5. Optionally override some templates in form-specific template directories -(/contact//...). - -6. Receive submitted forms by email and read them in admin. - - -Example: -======== - -settings.py: - CONTACT_FORMS_MODULE = 'myproject.contact_forms' - -myproject/contact_forms.py: - from django import forms - from contact.forms import ContactForm - from django.utils.translation import ugettext_lazy as _ - - class RegistrationForm(ContactForm): - form_tag = 'register' - name = forms.CharField(label=_('Name'), max_length=128) - presentation = forms.FileField(label=_('Presentation')) - -some_template.html: - {% url 'contact:form' 'register' %} - -""" - -from fnpdjango.utils.app import AppSettings - - -class Settings(AppSettings): - FORMS_MODULE = "contact_forms" - - -app_settings = Settings('CONTACT')