I have django choice field
The HTML rendered by django looks like this:
<select id="id_action" name="action">
<option value="" selected="selected">---</option>
<option value="query-action-take">Take</option>
<option value="query-action-forward">Forward</option>
</select>
Before executing the action which was choosen by the user, a confirmation should happen. But not all actions need a confirmation. In this example "delete" needs, but "take" does not need a confirmation.
I would like to add html data attributes the options
The result should look like this:
<select id="id_action" name="action">
<option value="" selected="selected">---</option>
<option value="query-action-take" data-need-confirm="False">Take</option>
<option value="query-action-delete" data-need-confirm="True">Delete</option>
</select>
Up to now I found no way to inject the data "need confirmation" into individual choices.
... or am I on the wrong track here?
This question is only about "how to get the data into the html". The evaluation of the data (confirmation popup) is not part of this question.