RETIRED, further work has moved to Debian project infrastructure
Go to file
tzangms 5fff56f715 Merge pull request #88 from escoular/fix-context-boundfields
Fix context for boundfields when Django version >= 1.8
2017-05-03 01:20:38 -05:00
bootstrapform Context not being flattened for bound fields 2016-09-11 09:29:41 -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 Context not being flattened for bound fields 2016-09-11 09:29:41 -05:00
.travis.yml Add tox 2016-03-21 02:15:52 +08: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 Kicking build 2016-09-11 09:57:59 -05:00
setup.py Add tox 2016-03-21 02:15:52 +08:00
tox.ini Context not being flattened for bound fields 2016-09-11 09:29:41 -05:00

README.rst

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.