When creating a user form, I am in need of multiple likert items to gauge opinions accurately. My project requires the use of the oTree library, which is closely integrated with django. It is essential that any solution implemented aligns with oTree as much as possible.
The RadioSelectHorizontal
widget appears to be the best fit for this task. However, there are two key modifications required from the default setup:
- The option labels ("agree", "neutral", etc.) must be positioned directly below the radio buttons.
- The radio buttons need to be evenly spaced, ideally extending across the entire width of the page.
In comparison, the default appearance will display the labels between the radio buttons and provide minimal spacing based on label length:
https://i.sstatic.net/onuTQ.png
The code snippet provided is as follows:
question_1 = models.IntegerField(widget=widgets.RadioSelectHorizontal,
label="some question",
choices=[[1, "strongly disagree"], [2, "disagree"], [3, "neutral"], [4, "agree"], [5, "strongly agree"]])
What steps should I take to address these requirements?
The django documentation suggests various methods such as custom widgets or custom CSS. However, it seems that oTree may have some limitations compared to django.
For clarity, here is an example that satisfies both conditions: