django-bootstrap-forms icondjango-bootstrap-forms 0.1

Twitter Bootstrap ready Django forms
django-bootstrap-forms is a Django app that provides Twitter bootstrap ready Django forms.

Installation

1. Install using pip:

        pip install -e git+git://github.com/earle/django-bootstrap.git#egg=bootstrap

2. Add to INSTALLED_APPS:

        'bootstrap',

Usage

    from bootstrap.forms import BootstrapForm, Fieldset

    class LoginForm(BootstrapForm):
        class Meta:
            layout = (
                Fieldset("Please Login", "username", "password", ),
            )

        username = forms.CharField(max_length=100)
        password = forms.CharField(widget=forms.PasswordInput(), max_length=100)

If you want to use the Bootstrap Form wrapper on a built-in form, such as those in `django.contrib.auth.forms` then you can use the mixin class.

    from django.contrib.auth.forms import PasswordChangeForm
    from bootstrap.forms import BootstrapMixin, Fieldset

    class BootstrapPasswordChangeForm(BootstrapMixin, PasswordChangeForm):
        class Meta:
            layout = (
                Fieldset("Change your password",
                        "old_password", "new_password1", "new_password2"),

When using the mixin directly it must be the first class your form inherits from.

Template Usage

    < form action="/login/" method="post" class="form-horizontal" >
        {{ form }}
        < div class="form-actions" >
            < button type="submit" class="btn btn-primary" >Login< /button >
        < /div >
    < /form >

last updated on:
July 28th, 2012, 13:24 GMT
price:
FREE!
developed by:
Earle Ady
license type:
The Apache License 2.0 
category:
ROOT \ Internet \ HTTP (WWW)

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

1 Screenshot
django-bootstrap-forms

Add your review!

SUBMIT