earle/django-bootstrap — pull request #43 by cre8r (2012-03-12 20:14:08+00:00)
Title: Improved BootstrapMixin so it could be used to decorate existing form with minimal effort

This change allows user to decorate existing forms easier. Let's say, a user wants to make `django.contrib.auth.forms.AuthenticationForm` pretty. Now he just needs to define a class like this:

class LoginForm(BootstrapMixin, AuthenticationForm):
pass

add Meta class if he wants to, and use resulting form in his view.
No more need to call `AuthenticationForm.__init__()` and `BootstrapMixin.__bootstrap__()` in constructor.
The only drawback I see is that `BootstrapMixin` must be the first base class, which is not intuitively obvious. The problem is that `BaseForm` class does not call parent's constructor. I've tried to use metaclasses to change base class order on the fly, but did not succeed, at least with reasonable amount of code.
Also I believe that using double underscored method names such as `__bootstrap__` is not the best idea, since this naming convention is intended for python magic and python internals.