Updating several records at once using Django

Use the queryset update() method:

id_list = list_of_ids_from_checkboxes

Your display HTML is missing a name value for the checkboxes. If you just have a single name across all checkboxes, then the list of IDs will be passed into a single POST variable, which you can get straight from request.POST (assuming you’re submitting your form as a post, which you should be):

id_list = request.POST.getlist('checkboxname')

Leave a Comment