[Fixed]-Submit ChoiceField form Django

1👍

You’ve defined your form init so that the first positional argument is networkList; so when you do form = SimpleDeploy(request.POST, networkList=None...), both the positional arg and the keyword arg both go to the same name, which isn’t allowed.

Don’t change the signature at all; get the extra values from kwargs.

def __init__(self, *args, **kwargs):
    networkList = kwargs.pop('networkList', None)
    policiesList = kwargs.pop('policiesList', None)
    applicationList = kwargs.pop('applicationList', None)
    super(...)

Alternatively, since you only need those values inside the form, you might consider just passing the request to this method and getting those values directly there; the same syntax would apply.

Leave a comment