#25495: CheckboxSelectMultiple cannot set CSS class of UL
-----------------------------+--------------------
     Reporter:  trolando     |      Owner:  nobody
         Type:  New feature  |     Status:  new
    Component:  Forms        |    Version:  1.7
     Severity:  Normal       |   Keywords:
 Triage Stage:  Unreviewed   |  Has patch:  0
Easy pickings:  1            |      UI/UX:  0
-----------------------------+--------------------
 It would be nice to be able to override (or actually: set) the class of
 the <ul> tag of a CheckboxSelectMultiple.
 Attributes of this tag cannot be set at the moment.

 Example code that I now use to "hack" the class into the <ul>. The example
 code is used in the context of mezzanine/grappelli, which provides a nice
 CSS with ul.checkboxlist that works well for admin pages.

 {{{
 class CheckboxSelectMultipleRenderer(CheckboxFieldRenderer):
     def render(self):
         result = super(CheckboxSelectMultipleRenderer, self).render()
         return mark_safe(re.sub("<ul id", '<ul class="checkboxlist" id',
 result, count=1))


 class CheckboxSelectMultipleCss(CheckboxSelectMultiple):
     renderer = CheckboxSelectMultipleRenderer
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25495>
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/051.f0161c53e2dfa33f8bbfb5e0f2364753%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to