Package: deform_bootstrap
deform_bootstrapprovidesTwitter Bootstrapcompatible widgets, templates
and styles for thedeform form library.deform_bootstrap isdeveloped on GitHub.  Latestreleases are
available on PyPI.How to use itI just downloaded this and wanna use itIn your Paste Deploy configuration file (e.g.development.ini) adddeform_bootstrapto the list ofpyramid_includes, or add a
this line if apyramid.includessetting does not exist:[app:main]
...
pyramid.includes = deform_bootstrapThis will put the templates indeform_bootstrap/templatesinto thedeform search path.I want to try it before usingIf you want to quickly try outdeform_bootstrapand see how it
looks in practice you can run these commands, assuming that you have avirtualenvset up in yourdeform_bootstrapdirectory:$ git clone https://github.com/Pylons/deformdemo.git
$ cd deformdemo
$ ../bin/python setup.py develop
$ cd ..
$ bin/pserve demo.iniYou should now be able to access the demo site athttp://0.0.0.0:8521Using tabs in formsTo make a tabbed form, use mapping. Each mapping will appear as a new
tab, taking the title of the mapping as the name for the tab.  If you
specify no tabs for some information, it will default to a ‘Basic’
tab.A form using the followingClientschema will render with two tabs
‘Person data’ and ‘Car stuffs’:import colander

class Person(colander.Schema):
    name = colander.SchemaNode(
        colander.String(),
        title='Name',
        )
    surname = colander.SchemaNode(
        colander.String(),
        title='Surname',
        )

class Car(colander.Schema):
    color = colander.SchemaNode(
        colander.String(),
        title='Color',
        )
    horsepower = colander.SchemaNode(
        colander.Integer(),
        title='Horsepower',
        )

class Client(colander.Schema):
    person = Person(title='Person data')
    car = Car(title='Car stuffs')Additional widgets / getting rid of legacy stuffjQueryUIDeform depends onjQueryUIfor these wigdgets:AutocompleteInputWidgetDateInputWidgetDateTimeInputWidgetdeform_bootstrapcomes with widgets that replace these, and that are
compatible with Bootstrap. If you don’t use any of these, you can skip
the remainder of this section and just deletejQueryUIfrom your CSS
and JS imports.  Otherwise you’ll need to addbootstrap-typeahead.jsand/orbootstrap-datepicker.jsto your JS includes.You can then use deform_bootstrap’s TypeaheadInputWidget as a drop in
replacement for deform’s AutocompleteInputWidget.Unfortunately things are a litte more complicated for DateInputWidget and
DateTimeInputWidget, becausebootstrapdoes not provide native widgets
for that usecases (yet?).  Therefore you will need to either usedeform_bootstrap.cssprovided bydeform_bootstrapor build your ownbootstrap.cssusingLESS <http://lesscss.org/>.  Once you havelesscinstalled it can be done like this:$ cd deform_bootstrap/static
$ lessc deform_bootstrap.lessYou’ll then find your customdeform_bootstrap.csswhich immediately leads
to a shiny new look for DateInputWidgets.  For DateTimeInputWidgets you’ll
have to replace your existing imports.  This is as easy as replacingfrom deform.widget import DateTimeInputWidgetwithfrom deform_bootstrap.widget import DateTimeInputWidgetin your code.<ul> / <li> markupDeform uses <ul> / <li> markup for rendering sequences.  Although one can
argue, that this is semanticaly correct, it doesn’t make much sense in the
context of form rendering and requires quite some additional CSS to produce
visually appealing results.  Thereforedeform_bootstrapremoves all list
markup and generates nice forms with no additional CSS required.In order to make this work with not only with fixed length sequences, but
also variable length sequences, 2 functions indeform.jsneeds to be
patched.  This can be done by simply adding the provideddeform_bootstrap.jsto your JS requirements.  If your application doesn’t
use variable length sequences, you can safely skip this step.Chosen by HarvestA progressively enhanced replacement for HTML select elements, Chosen
implements single and multiple selection modes that offer a much better
UX than the standard widgets.
It has autocomplete features, placeholder support and a slick style that
looks good either with or without Bootstrap.
Seehttp://harvesthq.github.com/chosen/for documentation and examples.
Only the jQuery version is provided by this package.Static resourcesdeform_bootstrapcomes with a bunch of static resources, which might
confuse you.  Fortunately most of them are just needed to passall thetests
and most most of them (if any) won’t be needed in yourdeform_bootstrapbased application.CSSdeform_bootstrap.cssThis file contains the complete Bootstrap 2.0.1 CSS plus additional
styles for the datepicker widget (see above).  You may use it for your
application (great for initial development), but might also want to consider
rolling your own customized version for deployment.jquery_chosen/chosen.cssThe main style forChosenSingleWidgetandChosenMultipleWidget.chosen_bootstrap.cssThis file contains a small fix for conflicts between chosen and bootstrap.
Only needed if you make use of chosen, but harmless if you don’t.bootstrap-datepicker.cssThe styles for thenativebootstrap datepicker widget (see above).Note thatchosen_bootstrap.cssandbootstrap-datepicker.cssare included indeform_bootstrap.css, so you will only need them
if you use some other version of the bootstrap css.JSbootstrap-datepicker.jsOnly needed if you want to use thenativebootstrap datepicker widget
(see above).bootstrap_typeahead.jsOnly needed if you want to use thenativebootstrap datepicker widget
(see above).bootstrap.min.jsOnly needed as a direct dependency of thebootstrap_XXX.jsfiles.deform_bootstrap.jsOnly needed as if you want to usevariable length sequences(see “<ul> / <li> markup” above).jquery-x.x.x.min.jsOnly needed if you want to use any of the other JS resources.jquery-ui-x.x.x.custom.min.jsOnly needed if prefer using deform’s orinialAutocompleteInputWidgetover deform_bootstrap’sTypeaheadInputWidgetor deform’sDateTimeInputWidgetover deform_bootstrap’snativeversion
(see above).jquery-ui-timepicker-addon-x.x.x.jsSame as forjquery-ui-x.x.x.custom.min.js.jquery.form-2.96.jsOnly needed if you want to useuse_ajax=Truewithdeform.Form.jquery.maskedinput-x.x.jsOnly needed if you wantmask='...'with any of thedeformwidgets that support it.jquery_chosen/chosen.jquery.jsOnly needed if you useChosenSingleWidget,ChosenOptGroupWidget, orChosenMultipleWidget,LESS / twitter_bootstrapNot needed at all. Only used internally to build the customdeform_bootstrap.csswith the additional datepicker styles.Information for developers / contributorsRunning unit tests$ bin/python setup.py dev
$ bin/py.testdeformdemodeform_bootstrappasses 100% of thedeformdemotests.  Please do run the Selenium
tests before submitting a patch.However, bootstrap requires a newer version of jquery than deform ships
with by default. This in turn would require a newer version of jquery.form
(> 2.43) which unfortunately is backward incompatible in its ajax handling.
Thus, deform_bootstrap cannot currently support deform’suse_ajaxfeature.
The corresponding selenium tests have therefore been disabled until deform
catches up. Note, that you can still use jquery.form itself.Running Selenium testsMake sure you have a Java interpreter installed.Download Selenium Server <http://seleniumhq.org/download/> standalone jar file.Start the server with demo.ini.In another terminal, runjava-jarselenium-server-standalone-X.X.jar.
Success is defined as seeing output on the console that ends like this:01:49:06.105 INFO - Started SocketListener on 0.0.0.0:4444
01:49:06.105 INFO - Startedorg.openqa.jetty.jetty.Server@7d2a1e44In yet another terminal, run the tests with the command:$ bin/python deform_bootstrap/demo/test.pyAPIinput_prepend / input_appendBootstrap has a nice feature to prepend/append text to input[type=text]
form elements (seehttp://twitter.github.com/bootstrap/base-css.html#forms).
To use it withdeform_bootstrapyou can simply passinput_prependorinput_appendas keyword arguments to the widget constructor in yourcolander.Schemasubclass:class PersonSchema(colander.Schema):
    weight = colander.SchemaNode(
        colander.Integer(),
        title=u"Weight",
        widget=deform.widget.TextInputWidget(
            input_append="kg",
            css_class="span1",
        ))bootstrap_form_styleBootstrap supportsfour form styles.  By default,deform_bootstrapuses the.form-horizontalstyle.  You can specify one of the other
styles be setting thebootstrap_form_styleattribute of yourForm:myform = Form(myschema, bootstrap_form_style='form-vertical')inlineBootstrap supports inline checkbox and radio choices.  NormallyRadioChoiceWidgets andCheckboxChoiceWidgetss are displayed
with one choice per line.  To select the inline style, set theinlineattribute of the choice widget to a trueish value:class MySchema(colander.Schema):
    choice = colander.SchemaNode(
        colander.String(),
        widget=deform.widget.CheckboxChoiceWidget(
            values=[(u'a', u'Apple'),
                    (u'b', u'Bear'),
                    (u'c', u'Computer')],
            inline=True))Thanksdeform_bootstrap was created by Daniel Nouri.  Thanks to the following
people for support, code, patches etc:Andreas KaiserChris McDonoughJason KölkerJeff DairikiMarco MarianiTom Lazarhttps://github.com/Kotti/deform_bootstrap/contributorsCHANGES0.2.9 - 2013-08-09Add bootstrap iconglyphs and fix deform_bootstrap.css to point to
them.  See #61Add readonly textinput that uses bootstrap styling.Add tabbed forms support.  SeeREADME.rstfor details.0.2.8 - 2013-06-25Fix resource registry.  See #56.Work around broken resource_filename() on Google AppEngine.  See #57.Fix all fields being marked invalid if another field in the same
mapping/sequence is.  See #58.0.2.7 - 2013-05-04Add support for Py3k.  See #55.Improve test coverage.  See #55.0.2.6 - 2013-02-23Inherit ChosenMultipleWidget from SelectWidget.  This fixes broken readonly
SelectWidgets.  See #49.Add support for css_class argument in Button constructor.  See #48.0.2.5Fix normalization of chosen widget values. (#40)Add remote source for TypeAheadInputWidget, ‘source’ attribute
renamed to ‘values’.  (#37)Fixedsequence_item.ptnot to break in Chameleon. (#39)0.2.4 - 2012-10-24Add missing requirements (jquery ui timepicker).0.2.3 - 2012-10-18Add support for deform’s new orderable sequence support.  See #34.0.2.2 - 2012-06-11Upgraded Bootstrap to v2.0.4Add missing alert class to mapping template for validation errors.0.2.1 - 2012-04-17Add ChosenOptGroupWidget.0.2 - 2012-03-20ChosenSingleWidget and ChosenMultipleWidget; includes chosen 0.9.7 [mmariani]Add support for “inline” checkbox and radio choices.Many bugfixes.  Many thanks to dairiki.0.1 - 2012-02-29Add TypeAheadInputWidget (with Selenium tests).Add DateTimeInputWidget (with “native” Bootstrap CSS/JS and Selenium tests).Ged rid of jQueryUI legacy.Get rid of ul/li markup legacy.Restructure / update documentation.Include latest versions of all JS/CSS resources, Bootstrap 2.0.1 LESS files
with additional datepicker widget.0.1a5 - 2012-02-09All deformdemo Selenium tests passing.Add sequence templates.0.1a4 - 2012-02-09Inincludeme, prepend deform search path instead of resetting
the whole renderer.0.1a3 - 2012-02-03Changes to support Bootstrap 2.0.Added support for Bootstrap’s feature to prepend/append text toinput[type=text]via input_prepend/input_append keyword
arguments todeform.Widgetconstructor.