Skip to content

Commit 257ae5a

Browse files
committed
Merge branch 'JoshData-documentation'
2 parents 5725764 + 6f44090 commit 257ae5a

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

README.rst

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,43 @@ Twitter Bootstrap for Django Form.
2222

2323
A simple Django template tag to work with `Bootstrap <http://twitter.github.com/bootstrap/>`_
2424

25-
Install
26-
=======
2725

28-
Add to ``INSTALLED_APPS``:
26+
Usage
27+
======
2928

30-
.. code-block ::
29+
Add "bootstrapform" to your INSTALLED_APPS.
3130

32-
# myapp/settings.py
33-
34-
INSTALLED_APPS = [
35-
'bootstrapform',
36-
# ...
37-
]
31+
At the top of your template load in our template tags::
3832

39-
Usage
40-
======
33+
{% load bootstrap %}
34+
35+
Then to render your form::
36+
37+
<form role="form">
38+
<legend>Form Title</legend>
39+
{% csrf_token %}
40+
{{ form|bootstrap }}
41+
<div class="form-group">
42+
<button type="submit" class="btn btn-primary">Submit</button>
43+
</div>
44+
</form>
45+
46+
You can also set class="form-vertical" on the form element.
4147

42-
Use it like this, simple.
48+
To use class="form-inline" on the form element, also change the "|boostrap" template tag to "|bootstrap_inline".
4349
44-
.. code-block::
50+
It is also possible to create a horizontal form. The form class and template tag are both changed, and you will also need slightly different CSS around the submit button::
4551

46-
{% load bootstrap %}
47-
{{ form|bootstrap }}
52+
<form class="form-horizontal">
53+
<legend>Form Title</legend>
54+
{% csrf_token %}
55+
{{ form|bootstrap_horizontal }}
56+
<div class="form-group">
57+
<div class="col-sm-10 col-sm-offset-2">
58+
<button type="submit" class="btn btn-primary">Submit</button>
59+
</div>
60+
</div>
61+
</form>
4862

4963

5064
Demo

0 commit comments

Comments
 (0)