[Answer]-Django Class Based View Form Won't Save Data To Database

1👍

in views.py you don’t need this line: objects = form.save()
It can be

class ContaktCreateView(CreateView):

model = Contakt
form_class = ContaktForm
template_name = "www/www_contakt.html"
success_url = '/thanks/'

def form_valid(self, form):
    return super(ContaktCreateView, self).form_valid(form) 

Also I’m not using action in form action=”/create/” method=”post”

You are calling this html form via your line in urls.py:

url(r'^create/$', CreateRequest.as_view())

which is using your CreateRequest view which is using your index.html form file.

Leave a comment