I'm trying to create a Django form fields that has radio choices and "other" choice that is a text field. It should look like this I tried this but its from 2014 and it's not working. Can you give me an idea how to fix this code or how can I create a custom widget that will do the job. Thank you for your help!
Asked
Active
Viewed 125 times
1 Answers
0
You can use HTML radio button form syntax and insert your Django templates.
<div>
<input type="radio" id="test" name="test"
checked>
<label for="test">{{ template }}</label>
<input type="radio" name="reason" value="">{{ template }} <input type="text" name="..." />
</div>

Captain Caveman
- 1,448
- 1
- 11
- 24
-
I'm creating a survey with questions app and I need to have different types of questions `QUESTION_TYPES = ( (TEXT, _("text (multiple line)")), (SHORT_TEXT, _("short text (one line)")), (RADIO, _("radio")), (SELECT, _("select")), (SELECT_MULTIPLE, _("Select Multiple")), (SELECT_IMAGE, _("Select Image")), (INTEGER, _("integer")), (FLOAT, _("float")), (DATE, _("date")), (RADIO_AND_TEXT, _("Radio and other")), ) ` In order of this to work i need it to be either field or widget. Thank you. – nikolata Mar 16 '21 at 15:54