summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2014-10-14 14:56:39 -0400
committerSimon Charette <charette.s@gmail.com>2014-10-30 19:10:52 -0400
commitf2ddc439b1938acb6cae693bda9d8cf83a4583be (patch)
treeccf7997832415683035ede7a289e79593248f4c2 /docs
parent19242c675f16ddde37b68af8bbe07de66e237e13 (diff)
Fixed #23656 -- Made FormMixin.get_form's form_class argument optional.
Thanks Tim Graham for the review.
Diffstat (limited to 'docs')
-rw-r--r--docs/internals/deprecation.txt3
-rw-r--r--docs/ref/class-based-views/mixins-editing.txt7
-rw-r--r--docs/releases/1.8.txt11
-rw-r--r--docs/topics/class-based-views/mixins.txt6
4 files changed, 22 insertions, 5 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index 9906119f14..b0fe326937 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -65,6 +65,9 @@ about each item can often be found in the release notes of two versions prior.
* The ``original_content_type_id`` attribute on
``django.contrib.admin.helpers.InlineAdminForm`` will be removed.
+* The backwards compatibility shim to allow ``FormMixin.get_form()`` to be
+ defined with no default value for its ``form_class`` argument will be removed.
+
.. _deprecation-removed-in-1.9:
1.9
diff --git a/docs/ref/class-based-views/mixins-editing.txt b/docs/ref/class-based-views/mixins-editing.txt
index 7a315ad7a3..1a06e2bb97 100644
--- a/docs/ref/class-based-views/mixins-editing.txt
+++ b/docs/ref/class-based-views/mixins-editing.txt
@@ -49,10 +49,15 @@ FormMixin
Retrieve the form class to instantiate. By default
:attr:`.form_class`.
- .. method:: get_form(form_class)
+ .. method:: get_form(form_class=None)
Instantiate an instance of ``form_class`` using
:meth:`~django.views.generic.edit.FormMixin.get_form_kwargs`.
+ If ``form_class`` isn't provided :meth:`get_form_class` will be used.
+
+ .. versionchanged:: 1.8
+
+ The ``form_class`` argument is not required anymore.
.. method:: get_form_kwargs()
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index dbdff7b7e0..26dad8d14b 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -242,6 +242,10 @@ Generic Views
:meth:`~django.views.generic.detail.SingleObjectMixin.get_object()`
so that it'll perform its lookup using both the primary key and the slug.
+* The :meth:`~django.views.generic.edit.FormMixin.get_form()` method doesn't
+ require a ``form_class`` to be provided anymore. If not provided ``form_class``
+ defaults to :meth:`~django.views.generic.edit.FormMixin.get_form_class()`.
+
Internationalization
^^^^^^^^^^^^^^^^^^^^
@@ -892,3 +896,10 @@ The ``original_content_type_id`` attribute on ``InlineAdminForm`` has been
deprecated and will be removed in Django 2.0. Historically, it was used
to construct the "view on site" URL. This URL is now accessible using the
``absolute_url`` attribute of the form.
+
+``django.views.generic.edit.FormMixin.get_form()``’s ``form_class`` argument
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+``FormMixin`` subclasses that override the ``get_form()`` method should make
+sure to provide a default value for the ``form_class`` argument since it's
+now optional.
diff --git a/docs/topics/class-based-views/mixins.txt b/docs/topics/class-based-views/mixins.txt
index 8918d6cbd2..172c4ad3ca 100644
--- a/docs/topics/class-based-views/mixins.txt
+++ b/docs/topics/class-based-views/mixins.txt
@@ -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: