RETIRED, further work has moved to Debian project infrastructure
Go to file
tzangms 9048ccdee9 Update README.rst
remove bitdeli
2015-03-09 22:59:15 +08:00
bootstrapform Merge pull request #53 from stephane/fix-bootstrap-horizontal-arg 2015-03-09 22:58:02 +08:00
docs fixed RST for link to Nivl 2013-09-09 22:44:16 -04:00
example Merge branch 'eureka' of https://github.com/caumons/django-bootstrap-form into caumons-eureka 2013-12-06 03:31:07 +08:00
tests Merge branch 'fix-tests' of https://github.com/nikolas/django-bootstrap-form into nikolas-fix-tests 2015-03-09 14:42:25 +00:00
.gitignore refine and fix unit test 2015-03-09 14:36:23 +00:00
.travis.yml Enable automated testing on Python 3.4 2014-06-24 19:09:47 -07:00
CHANGES.txt Update README and add CHANGES.txt 2013-12-06 03:40:56 +08:00
LICENSE add LICENSE 2011-09-13 20:59:07 -07:00
MANIFEST.in fix setup.py with MANIFEST.in 2012-02-14 21:23:14 +08:00
README.rst Update README.rst 2015-03-09 22:59:15 +08:00
runtests.py Merge branch 'fix-tests' of https://github.com/nikolas/django-bootstrap-form into nikolas-fix-tests 2015-03-09 14:42:25 +00:00
setup.py refine and fix unit test 2015-03-09 14:36:23 +00:00

Django bootstrap form

PyPI version

image

image

Twitter Bootstrap for Django Form.

A simple Django template tag to work with Bootstrap

Usage

Add "bootstrapform" to your INSTALLED_APPS.

At the top of your template load in our template tags:

{% load bootstrap %}

Then to render your form:

<form role="form">
    <legend>Form Title</legend>
    {% csrf_token %}
    {{ 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 "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

Checkout this Demo site to see it in action.