[Answer]-Django form submission error (passing parameter from view.py to form)

1👍

You correctly instantiate the form twice, once in the GET block and once in the POST. However, you only pass the my_arg argument in the GET block. Since your __init__ method requires that argument, you get an error. You should make sure to pass the argument both times.

0👍

The error means that there is no key word argument called my_arg in kwargs.

You might want to check if my_arg is present or not using if 'my_arg' in kwargs:

Finally the u means your data is in unicode. Wont cause any problem i guess.

👤Asur

Leave a comment