Fixed #23656 -- Made FormMixin.get_form's form_class argument optional.

Thanks Tim Graham for the review.
This commit is contained in:
Simon Charette 2014-10-14 14:56:39 -04:00
parent 19242c675f
commit f2ddc439b1
6 changed files with 93 additions and 11 deletions

View file

@ -463,16 +463,14 @@ Our new ``AuthorDetail`` looks like this::
def get_context_data(self, **kwargs):
context = super(AuthorDetail, self).get_context_data(**kwargs)
form_class = self.get_form_class()
context['form'] = self.get_form(form_class)
context['form'] = self.get_form()
return context
def post(self, request, *args, **kwargs):
if not request.user.is_authenticated():
return HttpResponseForbidden()
self.object = self.get_object()
form_class = self.get_form_class()
form = self.get_form(form_class)
form = self.get_form()
if form.is_valid():
return self.form_valid(form)
else: