[Answered ]-Validate dynamic checkboxes Django form

2👍

✅

form = MessageForm(people, data=request.POST) would do it.

But you shouldn’t change the form init’s signature. You should make people_list a kwarg so that you preserve request as the first positional arg:

def __init__(self, *args, **kwargs):
    people_list = kwargs.pop('people_list', None)
    super(MessageForm, self).__init__(*args, **kwargs)

Leave a comment