[Fixed]-Bootstrap drop down toggle with django widget

1๐Ÿ‘

I would better suggest use normal HTML form rather than django-form.
I am suitable in working with HTML form as it gives power to me to customize it to my needs.
And solution is similar to your earlier question here
So In your HTML template

<select class="form-control" name="country>
     <option value="India">India></option>
     <option value="Germany">Germany</option>
     ....
</select>

in your views.py

def someview(request):
    if request.method == "POST":
        country_name = request.POST['country']
    
    somemodel.objectname = countryname
    somemodel.save()

Remember to use name attribute in your form tag and request the same in view. It works for all html form tags.

๐Ÿ‘คchiseledCoder

Leave a comment