mirror of
https://github.com/django/django.git
synced 2025-08-31 15:57:45 +00:00
Fixed #23656 -- Made FormMixin.get_form's form_class argument optional.
Thanks Tim Graham for the review.
This commit is contained in:
parent
19242c675f
commit
f2ddc439b1
6 changed files with 93 additions and 11 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue