title: Associate radio buttons with table rows in Django
body: <p>I am making a website using django.  I have a pandas dataframe that I've converted to an html table in my <code>views.py</code> using pandas <code>DataFrame.to_html()</code>. I want to be able to add a radio button to each row of the table so that the user can select which row of the dataframe they want to use for further processing.  I have a radio button form in django but am not sure how to apply it to the table.</p>
  
  <p>form looks like this:</p>
  
  <pre><code>class RadioSelectForm(forms.Form):
    def __init__(self,*args,**kwargs):
      arg_list = kwargs.pop('arg_list')
      section_label = kwargs.pop('section_label')
      required_val = kwargs.pop('required_val')
  
      super(RadioSelectForm,self).__init__(*args,**kwargs)
      self.fields['choice'].choices = arg_list
      self.fields['choice'].label = section_label
      self.fields['choice'].required = required_val
  
    choice = forms.ChoiceField(widget=forms.RadioSelect())
  </code></pre>
  
  <p>html template looks like this:</p>
  
  <pre><code>&lt;div class="panel panel-body"&gt;
    &lt;div class="panel-title text-center"&gt;
      &lt;div class="table-responsive"&gt;
        {{ table1 | safe }}
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>views.py table generation looks like this (would like to add radio buttons to each row in this table):</p>
  
  <pre><code>dumy_df = pd.DataFrame(np.random.randn(6,4),index=dates,columns=list('ABCD'))  #just a placeholder dataframe for this question
  html_df = dumy_df.to_html(classes="table table-hover")
  template_dict = {'table1':html_df}
  
  return render(request,'DjangoTemplateName.html',template_dict)
  </code></pre>
  
  <p>Does anyone know if you can associate radio buttons with rows in a table in Django?</p>