[Django] #25495: CheckboxSelectMultiple cannot set CSS class of UL

26 views
Skip to first unread message

Django

unread,
Oct 3, 2015, 10:45:30 AM10/3/15
to django-...@googlegroups.com
#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.

Django

unread,
Oct 5, 2015, 5:14:10 PM10/5/15
to django-...@googlegroups.com
#25495: CheckboxSelectMultiple cannot set CSS class of UL
-----------------------------+--------------------------------------

Reporter: trolando | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by timgraham):

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


Comment:

I guess template-based widget rendering would add some flexibility here
(#15667). That feature is expected in Django 1.10. Do you think that would
meet your use case?

--
Ticket URL: <https://code.djangoproject.com/ticket/25495#comment:1>

Django

unread,
Oct 9, 2015, 2:28:51 PM10/9/15
to django-...@googlegroups.com
#25495: CheckboxSelectMultiple cannot set CSS class of UL
-----------------------------+--------------------------------------
Reporter: trolando | Owner: nobody
Type: New feature | Status: closed
Component: Forms | Version: 1.7
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => wontfix


Comment:

Feel free to reopen if you feel that other ticket doesn't offer a good
solution to this issue and you have an alternate proposal for what the API
could look like.

--
Ticket URL: <https://code.djangoproject.com/ticket/25495#comment:2>

Reply all
Reply to author
Forward
0 new messages