#26234: Add `css_classes` parameter to Form.as_*() methods
------------------------------+--------------------------------------
     Reporter:  willstott101  |                    Owner:  nobody
         Type:  New feature   |                   Status:  new
    Component:  Forms         |                  Version:  1.9
     Severity:  Normal        |               Resolution:
     Keywords:  css forms     |             Triage Stage:  Unreviewed
    Has patch:  1             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  1             |                    UI/UX:  0
------------------------------+--------------------------------------
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * needs_tests:   => 0


Comment:

 I'm concerned that adding this could open a can worms of customization
 parameters for the `as_*()` methods which I think are really meant as
 simple shortcuts when very little customization is needed .

 I'm inclined to say you should do this with a Python mixin:
 {{{
 class FormFieldClassesMixin(object):
     def __init__(self, *args, **kwargs):
         super(FormFieldClassesMixin, self).__init__(*args, **kwargs)
         for field_name, field in self.fields.items():
             field.widget.attrs['class'] = 'someClass'
 }}}
 or in your own custom template tag. See also
 [http://stackoverflow.com/questions/401025/define-css-class-in-django-
 forms ideas on stackoverflow].

--
Ticket URL: <https://code.djangoproject.com/ticket/26234#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.ce405bf2355bf802a6a8ca898946ddca%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to