13π
β
In HTML, every form field needs a name
attribute in order to be submitted to the backend. But for checkboxes, you can give them all the same name β but different values β so that they will be submitted as a list. So you can do this in your template:
<input type="checkbox" name="factura" value="{{ faktura.pk }}">
and in the view:
selected_values = request.POST.getlist('factura')
which will give you a list of the selected Factura ids.
π€Daniel Roseman
Source:stackexchange.com