Skip to content

Commit 2fd10d3

Browse files
authored
let there be colour
1 parent 333cfe4 commit 2fd10d3

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

README.rst

+36-12
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,26 @@ Installation
4040
============
4141

4242
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
4446
4547
$ pip install -U django-forms-builder
4648
4749
Otherwise you can download django-forms-builder and install it directly
48-
from source::
50+
from source:
51+
52+
.. code-block:: bash
4953
5054
$ python setup.py install
5155
5256
Once installed you can configure your project to use
5357
django-forms-builder with the following steps.
5458

5559
Add ``forms_builder.forms`` to ``INSTALLED_APPS`` in your project's
56-
``settings`` module::
60+
``settings`` module:
61+
62+
.. code-block:: python
5763
5864
INSTALLED_APPS = (
5965
# other apps
@@ -62,7 +68,9 @@ Add ``forms_builder.forms`` to ``INSTALLED_APPS`` in your project's
6268
6369
If you haven't already, ensure ``django.core.context_processors.request``
6470
is in the ``TEMPLATE_CONTEXT_PROCESSORS`` setting in your project's
65-
``settings`` module::
71+
``settings`` module:
72+
73+
.. code-block:: python
6674
6775
TEMPLATE_CONTEXT_PROCESSORS = (
6876
# other context processors
@@ -72,7 +80,9 @@ is in the ``TEMPLATE_CONTEXT_PROCESSORS`` setting in your project's
7280
)
7381
7482
Then add ``forms_builder.forms.urls`` to your project's ``urls``
75-
module::
83+
module:
84+
85+
.. code-block:: python
7686
7787
from django.conf.urls.defaults import patterns, include, url
7888
import forms_builder.forms.urls # add this import
@@ -86,12 +96,16 @@ module::
8696
url(r'^forms/', include(forms_builder.forms.urls)),
8797
)
8898
89-
Finally, sync your database::
99+
Finally, sync your database:
100+
101+
.. code-block:: bash
90102
91103
$ python manage.py syncdb
92104
93105
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
95109
96110
$ python manage.py migrate forms
97111
@@ -105,7 +119,9 @@ you can create and edit forms. Forms are then each viewable with their
105119
own URLs. A template tag ``render_built_form`` is also available for
106120
displaying forms outside of the main form view provided. It will
107121
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
109125

110126
{% render_built_form form_instance %}
111127
{% render_built_form form=form_instance %}
@@ -177,7 +193,9 @@ Each field in the sequence should be a three-item sequence containing
177193
an ID, a dotted import path for the field class, and a field name, for
178194
each custom field type. The ID is simply a numeric constant for the
179195
field, but cannot be a value already used, so choose a high number
180-
such as 100 or greater to avoid conflicts::
196+
such as 100 or greater to avoid conflicts:
197+
198+
.. code-block:: python
181199
182200
FORMS_BUILDER_EXTRA_FIELDS = (
183201
(100, "django.forms.BooleanField", "My cool checkbox"),
@@ -188,7 +206,9 @@ You can also define custom widget classes for any of the existing or
188206
custom form fields via the ``FORMS_BUILDER_EXTRA_WIDGETS`` setting.
189207
Each field in the sequence should be a two-item sequence containing
190208
the same ID referred to above for the form field class, and a dotted
191-
import path for the widget class::
209+
import path for the widget class:
210+
211+
.. code-block:: python
192212
193213
FORMS_BUILDER_EXTRA_WIDGETS = (
194214
(100, "my_module.MyCoolWidget"),
@@ -250,7 +270,9 @@ causing validation errors with the form, or a pipeline of events to
250270
occur on successful form submissions. Suppose we wanted to store a
251271
logged in user's username against each form when submitted, given
252272
a form containing a field with the label ``Username`` with its
253-
field_type set to ``Hidden``::
273+
field_type set to ``Hidden``:
274+
275+
.. code-block:: python
254276
255277
from django.dispatch import receiver
256278
from forms_builder.forms.signals import form_valid
@@ -279,7 +301,9 @@ XLS Export
279301

280302
By default, django-forms-builder provides export of form entries via
281303
CSV file. You can also enable export via XLS file (Microsoft Excel)
282-
by installing the `xlwt`_ package::
304+
by installing the `xlwt`_ package:
305+
306+
.. code-block:: bash
283307
284308
$ pip install xlwt
285309

0 commit comments

Comments
 (0)