Hey Chaitanya ,
You can do something like this
In the models.py
CHOICES=[('Basic','Basic'), ('Standard','Standard'), ('Advanced','Advanced')]
class Modelname(models.Model):
pack=models.CharField(max_length=12,choices=CHOICES,blank=True) *Forms.py
class Formname(forms.ModelForm): class *meta: * model=modelname
fields=(pack,name,email) *
widgets = { 'pack':forms.radioselect() }On Thu, 21 May 2020 at 11:19, chaitanya orakala <[email protected]> wrote: > Thank you for your response. I see some javascript inside the form. I am > not fully aware of it. is there any template which I can use in forms?? > > On Thu, May 21, 2020 at 1:22 AM Vishesh Mangla <[email protected]> > wrote: > >> #template >> >> <select id="cars" name="carlist" form="carform"> >> <option value="volvo">Volvo</option> >> <option value="saab">Saab</option> >> <option value="opel">Opel</option> >> <option value="audi">Audi</option> >> </select> >> >> >> >> <form class=”f1” style=”display:none;” method=> >> >> </form> >> >> >> >> >> >> <form class=”f2” style=”display:none;” method=> >> >> </form> >> >> <form class=”f3” style=”display:none;” method=> >> >> </form> >> >> <script> >> >> Document.querySelector(“select”).addEventListener(“change”,(ele)={ >> >> If ele.target.textContent ==”Volvo”: >> >> .. >> >> Else if >> >> ... >> >> Else >> >> ... >> >> }) >> >> </script> >> >> >> >> Otherwise just send a form to pick the user preference out of Basic, >> Standard, Advanced, get the request and based on the request’s attributes >> send a form back through redirect function. >> >> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for >> Windows 10 >> >> >> >> *From: *Sai <[email protected]> >> *Sent: *21 May 2020 10:00 >> *To: *Django users <[email protected]> >> *Subject: *How to invoke Sub Form which have MULTIPLE OPTIONS to choose >> inside Django Form. >> >> >> >> Hi Everyone, >> >> I am pretty much familiar with Django Forms with models. I want to build >> a Submit Form which consists of attributes like UserName, Email, address >> field and 3 options to select the packages, for example, Basic, Standard, >> and Advanced. I have gone through Django Docs but there is no such thing. >> >> >> >> Please let me know how to achieve this and open to ideas. >> >> >> >> Thank You in Advance. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/cb12fc88-0d5a-4ec4-a6d6-1272a0a69d9a%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/cb12fc88-0d5a-4ec4-a6d6-1272a0a69d9a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/5ec6100b.1c69fb81.97f6e.083a%40mx.google.com >> <https://groups.google.com/d/msgid/django-users/5ec6100b.1c69fb81.97f6e.083a%40mx.google.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAPcTzRaKzDosDCbUMR%3DHyM6bDEvk3VPmhEEcZ750Lho0uwrFjw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAPcTzRaKzDosDCbUMR%3DHyM6bDEvk3VPmhEEcZ750Lho0uwrFjw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANqZwQmvAk-ZW7U-s-c97PZmuQSmB1mnJ-LfFK8wZYqjg3DSiA%40mail.gmail.com.

