@@ -40,20 +40,26 @@ Installation
40
40
============
41
41
42
42
The easiest way to install django-forms-builder is directly from PyPi
43
- using `pip `_ by running the command below::
43
+ using `pip `_ by running the command below:
44
+
45
+ .. code-block :: bash
44
46
45
47
$ pip install -U django-forms-builder
46
48
47
49
Otherwise you can download django-forms-builder and install it directly
48
- from source::
50
+ from source:
51
+
52
+ .. code-block :: bash
49
53
50
54
$ python setup.py install
51
55
52
56
Once installed you can configure your project to use
53
57
django-forms-builder with the following steps.
54
58
55
59
Add ``forms_builder.forms `` to ``INSTALLED_APPS `` in your project's
56
- ``settings `` module::
60
+ ``settings `` module:
61
+
62
+ .. code-block :: python
57
63
58
64
INSTALLED_APPS = (
59
65
# other apps
@@ -62,7 +68,9 @@ Add ``forms_builder.forms`` to ``INSTALLED_APPS`` in your project's
62
68
63
69
If you haven't already, ensure ``django.core.context_processors.request ``
64
70
is in the ``TEMPLATE_CONTEXT_PROCESSORS `` setting in your project's
65
- ``settings `` module::
71
+ ``settings `` module:
72
+
73
+ .. code-block :: python
66
74
67
75
TEMPLATE_CONTEXT_PROCESSORS = (
68
76
# other context processors
@@ -72,7 +80,9 @@ is in the ``TEMPLATE_CONTEXT_PROCESSORS`` setting in your project's
72
80
)
73
81
74
82
Then add ``forms_builder.forms.urls `` to your project's ``urls ``
75
- module::
83
+ module:
84
+
85
+ .. code-block :: python
76
86
77
87
from django.conf.urls.defaults import patterns, include, url
78
88
import forms_builder.forms.urls # add this import
@@ -86,12 +96,16 @@ module::
86
96
url(r ' ^ forms/' , include(forms_builder.forms.urls)),
87
97
)
88
98
89
- Finally, sync your database::
99
+ Finally, sync your database:
100
+
101
+ .. code-block :: bash
90
102
91
103
$ python manage.py syncdb
92
104
93
105
As of version 0.5, django-forms-builder provides `South `_ migrations.
94
- If you use south in your project, you'll also need to run migrations::
106
+ If you use south in your project, you'll also need to run migrations:
107
+
108
+ .. code-block :: bash
95
109
96
110
$ python manage.py migrate forms
97
111
@@ -105,7 +119,9 @@ you can create and edit forms. Forms are then each viewable with their
105
119
own URLs. A template tag ``render_built_form `` is also available for
106
120
displaying forms outside of the main form view provided. It will
107
121
display a form when given an argument in one of the following
108
- formats, where ``form_instance `` is an instance of the ``Form `` model::
122
+ formats, where ``form_instance `` is an instance of the ``Form `` model:
123
+
124
+ .. code-block :: html+django
109
125
110
126
{% load forms_builder_tags %}
111
127
@@ -179,7 +195,9 @@ Each field in the sequence should be a three-item sequence containing
179
195
an ID, a dotted import path for the field class, and a field name, for
180
196
each custom field type. The ID is simply a numeric constant for the
181
197
field, but cannot be a value already used, so choose a high number
182
- such as 100 or greater to avoid conflicts::
198
+ such as 100 or greater to avoid conflicts:
199
+
200
+ .. code-block :: python
183
201
184
202
FORMS_BUILDER_EXTRA_FIELDS = (
185
203
(100 , " django.forms.BooleanField" , " My cool checkbox" ),
@@ -190,7 +208,9 @@ You can also define custom widget classes for any of the existing or
190
208
custom form fields via the ``FORMS_BUILDER_EXTRA_WIDGETS `` setting.
191
209
Each field in the sequence should be a two-item sequence containing
192
210
the same ID referred to above for the form field class, and a dotted
193
- import path for the widget class::
211
+ import path for the widget class:
212
+
213
+ .. code-block :: python
194
214
195
215
FORMS_BUILDER_EXTRA_WIDGETS = (
196
216
(100 , " my_module.MyCoolWidget" ),
@@ -252,7 +272,9 @@ causing validation errors with the form, or a pipeline of events to
252
272
occur on successful form submissions. Suppose we wanted to store a
253
273
logged in user's username against each form when submitted, given
254
274
a form containing a field with the label ``Username `` with its
255
- field_type set to ``Hidden ``::
275
+ field_type set to ``Hidden ``:
276
+
277
+ .. code-block :: python
256
278
257
279
from django.dispatch import receiver
258
280
from forms_builder.forms.signals import form_valid
@@ -281,7 +303,9 @@ XLS Export
281
303
282
304
By default, django-forms-builder provides export of form entries via
283
305
CSV file. You can also enable export via XLS file (Microsoft Excel)
284
- by installing the `xlwt `_ package::
306
+ by installing the `xlwt `_ package:
307
+
308
+ .. code-block :: bash
285
309
286
310
$ pip install xlwt
287
311
0 commit comments