Skip to content

Commit 4b7b065

Browse files
authored
Merge pull request stephenmcd#213 from bashu/patch-5
let there be colour
2 parents c203824 + 2fd10d3 commit 4b7b065

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
{% load forms_builder_tags %}
111127

@@ -179,7 +195,9 @@ Each field in the sequence should be a three-item sequence containing
179195
an ID, a dotted import path for the field class, and a field name, for
180196
each custom field type. The ID is simply a numeric constant for the
181197
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
183201
184202
FORMS_BUILDER_EXTRA_FIELDS = (
185203
(100, "django.forms.BooleanField", "My cool checkbox"),
@@ -190,7 +208,9 @@ You can also define custom widget classes for any of the existing or
190208
custom form fields via the ``FORMS_BUILDER_EXTRA_WIDGETS`` setting.
191209
Each field in the sequence should be a two-item sequence containing
192210
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
194214
195215
FORMS_BUILDER_EXTRA_WIDGETS = (
196216
(100, "my_module.MyCoolWidget"),
@@ -252,7 +272,9 @@ causing validation errors with the form, or a pipeline of events to
252272
occur on successful form submissions. Suppose we wanted to store a
253273
logged in user's username against each form when submitted, given
254274
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
256278
257279
from django.dispatch import receiver
258280
from forms_builder.forms.signals import form_valid
@@ -281,7 +303,9 @@ XLS Export
281303

282304
By default, django-forms-builder provides export of form entries via
283305
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
285309
286310
$ pip install xlwt
287311

0 commit comments

Comments
 (0)