3👍
You should create a view that extends FormView
:
from myapp.forms import YourForm
from django.views.generic.edit import FormView
class YourView(FormView):
template_name = 'template.html'
form_class = YourForm
success_url = '/thanks/'
def form_valid(self, form):
print(form.cleaned_data)
And make sure you have a template that will display the form:
<form action="" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Send message" />
</form>
And when you submit the form, it should print the form’s data in your console!
Source:stackexchange.com