RETIRED, further work has moved to Debian project infrastructure
Go to file
tzangms 9755e29923 Merge pull request #75 from nikolas/py35
enable automated testing on python 3.5
2015-12-04 13:31:48 +08:00
bootstrapform enable automated testing on python 3.5 2015-12-03 21:11:59 -05: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.5 2015-12-03 21:11:59 -05:00
CHANGES.txt Bump to version 3.2 2015-03-09 16:08:47 +00: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 enable automated testing on python 3.5 2015-12-03 21:11:59 -05: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.