News for hackers. Stuff that matters.
Re:Learn web development: Django Web Framework by vivekd on Friday February 10, 2017 @12:11PM (#13616956)
Sorry typo, it should be the second blank is the empty space where the user input goes.

I just tried your solution with cleaned_data["formfield1"] instead of cleaned_data("formfield1","") and it didn't work for me, it came back with the following error message when I submitted the form:

>'builtin_function_or_method' object is not subscriptable

I think you have to have the empty quotes after the form field and I think that's what's capturing the user input

so here "form.cleaned_data("formfield1","") seems to be telling django the form name and then the second field is where the associated user input goes which is then passed to the model.

Re:Learn web development: Django Web Framework by vivekd on Saturday February 11, 2017 @02:00AM (#13621503)
wait just tried the code again, you were right, I don't need the second empty string. I was using [] with get and it wasn't working.

so it seems the right way is form.cleaned_data.get('formfieldvalue')

or

form.cleaned_data[formfieldvalue']

if you don't want to use get