oTree Forum >

Help on Likert Scale

#1 by april30


So I am trying to make likert scale in my survey.And I followed codes here https://otree.readthedocs.io/en/latest/forms.html#example-radio-buttons-in-tables-and-other-custom-layouts 

def make_field(label):
    return models.IntegerField(
                [1,'Strongly agree'],
                [2, 'agree'],
                [3, 'agree a little'],
                [4, 'neutral'],
                [5, 'disagree a little'],
                [6, 'Disagree'],
                [7, 'Strongly Disagree'],

class Player(BasePlayer):
    peq1 = make_field('label question 1  ')
 and then include the following part in the html. But I keep getting the message " TypeError: 'IntegerField' object is not iterable" Anyone know what's going on?
 <table class="table">
    {{ for field in form }}
            <th>{{ field.label }}</th>
            {{ for choice in field }}
                <td>{{ choice }}</td>
            {{ endfor }}
    {{ endfor }}

Write a reply

Set forum username