Created
October 3, 2012 11:24
-
-
Save artofhuman/3826463 to your computer and use it in GitHub Desktop.
Django HorizRadioSelect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.html import mark_safe | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment