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
2013-09-09 22:44:16 -04:00
2016-03-21 02:15:52 +08:00
2015-03-09 16:08:47 +00:00
2011-09-13 20:59:07 -07:00
2012-02-14 21:23:14 +08:00
2015-03-09 22:59:15 +08:00
2016-09-11 09:57:59 -05:00
2016-03-21 02:15:52 +08: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.

Description
RETIRED, further work has moved to Debian project infrastructure
Readme 303 KiB
Languages
HTML 59.1%
Python 40.9%