[Answer]-Passing a Tuple of Values through a Checkbox

1👍

Compose IDs of both models to a single value for the checkbox:

{% for sw in software %}
  {{sw}}
  {% for citation in all_citations %}
    <input type="checkbox" name="selection" value="{{citation.id}}-{{sw.id}}">
  {% endfor %}
{% endfor %}

And then deconstruct this values in the view:

ids = [value.split('-') for value in request.POST.getlist('selection')]

Leave a comment