How to make radio button in django this is what i did but its not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make radio button in django this is what i did but its not working

this is in forms.py from django import forms class medical_reports(forms.ModeIForm): # Healthy & Unhealthy Habits # Exercise Exercise.choice ; I ('Never '), ('1 - 2 days'), ('3 - 4 days'), ('5 + days'), Exercise ; forms.ChoiceField(choices; Exercise.choice, widget ;forms .RadioSelect) # Eating following a diet Eating_choices ; I ('l have a loose diet '), ('l have a strict diet '), ('l dont have a diet plan '), Eating ; forms.ChoiceField(choices;Eating_choices, widget ;forms .RadioSelect) # Alcohol Consumption Drink.choices ; I ('l dont drink '), ('1-2 glasses/day '), ('3-4 glasses/day '), ('5+ glasses/day '), Drink ; forms.ChoiceField(choices; Drm k.choices, widget ;forms .RadioSelect) ----------- this is in models.py # for Exercise in form.py Exercise = models.CharField(max_length=100) # for Eating in form.py Eating = models.CharField(max_length=100) # for Drink in form.py Drink = models.CharField(max_lengt

31st May 2021, 9:44 AM
Benjamin
Benjamin - avatar
4 Answers
+ 1
don't post duplicate of your previously question, specially when you have still got answers ^^ https://www.sololearn.com/Discuss/2799518/?ref=app
31st May 2021, 6:01 PM
visph
visph - avatar
+ 1
Benjamin I can't understand why you are getting problem. It's just simple to follow these. https://code.sololearn.com/cUZ59brC3LUl/?ref=app https://code.sololearn.com/cZvc8NdKFo48/?ref=app It works perfectly. I have also posted this in your previous question already. (DON'T FORGET TO APPLY MIGRATIONS)
8th Jun 2021, 3:05 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
AKSHAY🇮🇳 thanks alot I have done it my forms.py was in my migrations folder that's was the issue
8th Jun 2021, 3:37 PM
Benjamin
Benjamin - avatar
+ 1
Benjamin is it solved now??
9th Jun 2021, 2:48 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar