September 29, 2010 | In: Django, Open Source, Python

django-requiredfields open sourced

There are several useful bits fo code we use in various Django projects. One of the most commonly used is a piece of code which modifies BoundField and Widget classes (from django.forms) in a way to add class=’required’ attribute to rendered HTML widget of a field that is required in terms of Django validation. Thanks to this, one can easily apply some CSS for such fields to make forms even more user-friendly.

You can check out how it works in AlertGrid. We added some javascript and css to highlight required fields and remove highlight when user fills in some data into a field. We share those css and js bits of code as well.

You can find all at Bitbucket.org

Comment Form