~ubuntuone-pqm-team/django-crispy-forms/stable

« back to all changes in this revision

Viewing changes to docs/crispy_tag_forms.rst

  • Committer: Miguel Araujo Perez
  • Date: 2013-08-31 19:18:49 UTC
  • Revision ID: git-v1:df13e84e743fb9b6ffeeefeb47f4fd535d7ff2a3
Added Bootstrap 3 inline forms support

Related to #233

Show diffs side-by-side

added added

removed removed

Lines of Context:
284
284
    helper.field_class = 'col-lg-8'
285
285
 
286
286
Of course you can set your widths as you like, it doesn't have to be exactly like this.
 
287
 
 
288
Bootstrap3 inline forms
 
289
~~~~~~~~~~~~~~~~~~~~~~~
 
290
 
 
291
The way you do inline forms in Bootstrap version 3 is::
 
292
 
 
293
    helper.form_class = 'form-inline'
 
294
    helper.field_template = 'bootstrap3/layout/inline_field.html'
 
295
    helper.layout = Layout(
 
296
        'last_name',
 
297
        'email',
 
298
        'password',
 
299
    )
 
300
 
 
301
If you need to set attributes in a field, you have to use ``InlineField`` instead of ``Field``::
 
302
 
 
303
    from crispy_forms.bootstrap import InlineField
 
304
 
 
305
    helper.layout = Layout(
 
306
        InlineField('last_name', readonly=True),
 
307
        'email',
 
308
        'password',
 
309
    )