For a user form I need several likert items. (Questions to assess the degree of an opinion. Example at the bottom)
I’m required to use the oTree library, which heavily builds on django. A solution that deviates from oTree as little as possible is desirable.
RadioSelectHorizontal widget seems like the obvious choice here. But two differences to the default are mandatory:
- the option labels (“agree”, “neutral”, etc.) have to be positioned just underneath the radio buttons.
- the radio buttons have to be evenly spaced. (Ideally, they are aligned across the entire page)
In contrast, the default look will have the labels between the radio buttons and allow only as little space as each label needs:
question_1 = models.IntegerField(widget=widgets.RadioSelectHorizontal, label="some question", choices=[[1, "strongly disagree"], [2, "disagree"], [3, "neutral"], [4, "agree"], [5, "strongly agree"]])
How can I approach this?
django documentation mentions several approachs, i.e. custom widgets, custom CSS and more. But as far as I can tell, oTree is a bit more limited than django.
For illustration an example that meets both requirements: