Reputation: 8791
I'm trying to develop a Survey app and I found this example about how to render radio buttons horizontally. But, I would like to transform this in a "vertical render". But this is already using \n which means a new line for each new radio button right? How should I transform it in vertical radio buttons?
class HorizontalRadioRenderer(forms.RadioSelect.renderer):
def render(self):
return mark_safe(u'\n'.join([u'%s\n' % w for w in self]))
Upvotes: 0
Views: 183
Reputation: 15084
This is html - \n
won't translate to a new line. Try using
return mark_safe(u'<br />'.join([u'%s<br />' % w for w in self]))
Upvotes: 1