forms - Get selected radio button value in view in Django -


i have case want use radio buttons query option can correct query set according selected radio button. can not find way selected radio button value in form. there lot of info using form class. simple html form. part of form is:

<label for="house-all-id">all</label> <input type="radio" id="house-all-id" name="h-type" value="0"/> <label for="house-orp-id">just case one</label> <input type="radio" id="house-orp-id" name="h-type" value="1"/> <label for="house-inm-id">just case two</label> <input type="radio" id="house-inm-id" name="h-type" value="2"/> 

these radio-buttons part of widgets correct queryset. in view:

    h_type = request.post.get('h_type') 

this returns none-type object. how can value of selected radio button?

your fields named "h-type" you're trying access "h_type".


Comments

Popular posts from this blog

php - Autoloader issue not returning Class -

C++ Program To Find Smallest and Largest Number In Array -

java - How to put two numbers separated by a space into two different arrays -