1👍
is_valid()
checks the form’s errors
property which (assuming it hasn’t already been run) calls full_clean()
which calls _clean_form()
which calls clean()
so there is no need to call the method directly.
keep feeling like self.cleaned_data.get is redundant because I call is_valid() in views.py
I’m not 100% sure on your objection, but note that cleaned_data
will be empty unless clean()
completes successfully, so your search
function won’t work properly without the check. You are correct that you shouldn’t need to use get
there for any required fields, but since you don’t have required fields it’s still a better bet.
👤Tom
Source:stackexchange.com