No doubt I'm missing something obvious here...
urls.py
url(r'^screening_add/$', ScreeningCreate.as_view(), name="screening_add"),
views.py
class ScreeningCreate(CreateView):
model = Screening
def form_valid(self, form):
return super(ScreeningCreate, self).form_valid(form)
screening_form.html
<form action="." method="post"> {{ form }}{% csrf_token %}
<input type="submit" value="Submit">
</form>
This puts up the form with the Screening fields but on submit nothing happens. I have a breakpoint at the return statement in form_valid and it doesn't get executed. Removing the dot in action has no effect. What the heck am I missing?
Is this is your whole views.py? It should like this:
class ScreeningCreate(CreateView):
model = Screening
form_class = ScreeningForm
def form_valid(self, form):
return super(ScreeningCreate, self).form_valid(form)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.