How to access submitted form request data in Django
I want value of submitted data in init . I can get data after form.valid() through cleaned_data but can't access those data in init after submitting form
form.py
class MyForm(forms.Form):
def __init__(self, *args, **kwargs):
// Want to access submitted source and medium data here
super(MyForm, self).__init__(*args, **kwargs)
// or Want to access submitted source and medium data here
view.py
I am getting two different value source
and medium
in request.GET
myform = MyForm(request.GET)
The data is just the first parameter, so we can work with:
class MyForm(forms.Form):
def __init__(self, data=None, *args, **kwargs):
if data is not None and 'source' in data:
print(data['source'])
super().__init__(data, *args, **kwargs)