[Answer]-Django How to create an "order of preference Q" is a survey form

1πŸ‘

βœ…

In this case I would have a separate field for each of the news access type.

class MyForm(forms.Form):
    radio = forms.IntegerField(min_value=1, max_value=5)
    tv = forms.IntegerField(min_value=1, max_value=5)
    newspapers = forms.IntegerField(min_value=1, max_value=5)
    online = forms.IntegerField(min_value=1, max_value=5)
    none = forms.IntegerField(min_value=1, max_value=5)

This will force the user to provide a value for each field. You would then need to use the form clean_field() and clean() methods to ensure they are entering the values you expect, but that goes beyond the scope of this question.

πŸ‘€hellsgate

Leave a comment