from django.views.generic import CreateView
from .forms import FooForm
from .models import FooModel
class FooCreateView(CreateView):
model = FooModel # we keep this line to avoid the template_name attribute
form_class = FooForm
success_url = '/'
def form_valid(self, form):
form.instance.text = 'Is valid'
return super().form_valid(form)