#28060: Add the horizontal radio selection renderer
-----------------------------------------+------------------------
Reporter: Musen | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I propose to add the render for horizontal radio selection. When a set of
choices is rendered into a radio selection list, Django will list the
radio selection vertically by default. People come to trouble when they
want to make the radio list horizontal.
I propose to add a Horizontal radio selection render that is similar to
{{{
from django.utils.safestring import mark_safe
class HorizontalRadioRenderer(forms.RadioSelect.renderer):
def render(self):
return mark_safe(u'\n'.join([u'%s\n' % w for w in self]))
class ApprovalForm(forms.Form):
approval = forms.ChoiceField(choices=APPROVAL_CHOICES,
initial=0,
widget=forms.RadioSelect(renderer=HorizontalRadioRenderer),
)
}}}
This could as solve ticket #28059.
PS. The code for `HorizontalRadioRenderer` seems to be a folklore on the
internet for years, it can be found on
*[http://stackoverflow.com/questions/5935546/align-radio-buttons-
horizontally-in-django-forms stackoverflow] and
*[https://wikis.utexas.edu/display/~bm6432/Django-
Modifying+RadioSelect+Widget+to+have+horizontal+buttons UTexas Wiki].
--
Ticket URL: <https://code.djangoproject.com/ticket/28060>
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/052.60010b1b3da85ede7a952ecc341cfa30%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.