Horizontal RadioSelect widget

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from django.forms.widgets import RadioSelect

class HorizRadioRenderer(RadioSelect.renderer):
    """ this overrides widget method to put radio buttons horizontally
        instead of vertically.
    """
    def render(self):
            """Outputs radios"""
            return mark_safe(u'\n'.join([u'%s\n' % w for w in self]))

class HorizRadioSelect(RadioSelect):
    renderer = HorizRadioRenderer

More like this

  1. Rendering radio-buttons with icons instead of labels by jeverling 4 years, 1 month ago
  2. Choice Submit Widget by fredbird 2 years, 5 months ago
  3. ChoiceField with widget in choice by alfonsopalomares 5 years, 1 month ago
  4. RadioSelectWithHelpText by moxypark 3 years, 8 months ago
  5. Radio widget with labels after inputs by avsd 1 year, 9 months ago

Comments

(Forgotten your password?)