1

Is there a way for a template to examine the value of an individual radio button?

I know how to get other attributes:

{% for button in myform.radio_select %}
    {{button.tag}}
    {{button.choice_label}}
    {{button.id_for_label}}
{% endfor %}

But how do I get the value? I tried the obvious {{button.value}} and the less obvious {{button.tag.value}} but they did not work.

John Gordon
  • 29,573
  • 7
  • 33
  • 58

1 Answers1

4

The answer to this question says that as of Django 1.11, the value is stored in {{button.data.value}}.

Previous versions of Django used {{button.choice_value}}.

John Gordon
  • 29,573
  • 7
  • 33
  • 58