Usage

Start a django project from scratch

Create virtualenv

$ mkdir test_lead
$ cd test_lead
$ mkvirtualenv leads

Install from pip

$ pip install django-leads

Start a brand new django project

$ django-admin.py startproject mysite

Edit settings.py

INSTALLED_APPS = (
    ...
    'floppyforms',
    'crispy_forms',
    'leads',
)
...
CRISPY_TEMPLATE_PACK = 'bootstrap3'

Edit urls.py

...
import leads.urls

urlpatterns = patterns('',
    ...
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include(leads.urls, namespace='leads')),
)

Build database

$ python manage.py syncdb

Launch server

$ python manage.py runserver

Overriding templates

To have a reference you can copy the current templates:

$ cd <your_django_project_path>
$ mkdir templates
$ cd templates
$ cp -r ~/.virtualenvs/<your_virtualenv>/lib/python2.7/site-packages/leads/templates/leads .

Make sure you can load templates from <your_django_project_path>/templates (check your settings.py):

PROJECT_PATH = os.path.dirname(os.path.realpath(__file__))
TEMPLATE_DIRS = (
    os.path.join(PROJECT_PATH, '..', 'templates'),
)

Now you can override any template contained in ../templates/leads

Advanced settings

django-leads allows the user to set some settings to change the default behaviour

Setting name Explanation
LEADS_REGISTER_MODEL Define a custom Model to save data
LEADS_REGISTER_MODEL_ADMIN Define a custom ModelAdmin class
LEADS_REGISTER_FORM_FIELDS Specify the fields that will be shown in the form
LEADS_REGISTER_FORM_CLASS Define a custom FormModel to represent the form

Example:

# settings.py
LEADS_REGISTER_FORM_CLASS = 'myapp.forms.CustomRegisterForm'
LEADS_REGISTER_FORM_FIELDS = ('email',)
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.