Merge branch 'JoshData-documentation'
This commit is contained in:
44
README.rst
44
README.rst
@@ -22,29 +22,43 @@ Twitter Bootstrap for Django Form.
|
|||||||
|
|
||||||
A simple Django template tag to work with `Bootstrap <http://twitter.github.com/bootstrap/>`_
|
A simple Django template tag to work with `Bootstrap <http://twitter.github.com/bootstrap/>`_
|
||||||
|
|
||||||
Install
|
|
||||||
=======
|
|
||||||
|
|
||||||
Add to ``INSTALLED_APPS``:
|
|
||||||
|
|
||||||
.. code-block ::
|
|
||||||
|
|
||||||
# myapp/settings.py
|
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
|
||||||
'bootstrapform',
|
|
||||||
# ...
|
|
||||||
]
|
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
======
|
======
|
||||||
|
|
||||||
Use it like this, simple.
|
Add "bootstrapform" to your INSTALLED_APPS.
|
||||||
|
|
||||||
.. code-block::
|
At the top of your template load in our template tags::
|
||||||
|
|
||||||
{% load bootstrap %}
|
{% load bootstrap %}
|
||||||
|
|
||||||
|
Then to render your form::
|
||||||
|
|
||||||
|
<form role="form">
|
||||||
|
<legend>Form Title</legend>
|
||||||
|
{% csrf_token %}
|
||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
|
<div class="form-group">
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
You can also set class="form-vertical" on the form element.
|
||||||
|
|
||||||
|
To use class="form-inline" on the form element, also change the "|boostrap" template tag to "|bootstrap_inline".
|
||||||
|
|
||||||
|
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::
|
||||||
|
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<legend>Form Title</legend>
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form|bootstrap_horizontal }}
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-10 col-sm-offset-2">
|
||||||
|
<button type="submit" class="btn btn-primary">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
Demo
|
Demo
|
||||||
|
Reference in New Issue
Block a user