I have option groups, somethings like this:
Choices = (('Group1',(('Option1','Option1'),('Option2','Option2'))))
Is there anyway to display the options horizontally instead of vertically using the SelectMultiple
Widget? My problem is that I have too many Groups, so if i could have something like the following it would be better.
Group 1 - Option1, Option2, ...
Group 2 - Option1, Option2, ...
Update - Found this but it only "works" for CheckboxSelectMultiple. How should I change it in order to work with SelectMultiple?
from django.utils.safestring import mark_safe
class HorizWidget(forms.SelectMultiple):
def render(self, *args, **kwargs):
output = super(HorizWidget, self).render(*args,**kwargs)
return mark_safe(output.replace(u'<ul>', u'').replace(u'</ul>', u'').replace(u'<li>', u'<p>').replace(u'</li>', u'</p>'))
', u'').replace(u'
', u'').replace(u'').replace(u'