diff options
| author | Tim Graham <timograham@gmail.com> | 2015-09-03 14:41:54 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-23 19:31:10 -0400 |
| commit | 491de4f07c5018aa6f409dbc9bcf32ff631d5f2e (patch) | |
| tree | 1ddf4d08d06d2b2ac5824c273fc5bc15b5da7d9c /django | |
| parent | 849037af36000d53b0b3b52f780ff475534e195b (diff) | |
Refs #23656 -- Required FormMixin.get_form() form_class parameter to be optional.
Per deprecation timeline.
Diffstat (limited to 'django')
| -rw-r--r-- | django/views/generic/edit.py | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py index ad357117c3..6223129786 100644 --- a/django/views/generic/edit.py +++ b/django/views/generic/edit.py @@ -1,11 +1,6 @@ -import inspect -import warnings - from django.core.exceptions import ImproperlyConfigured from django.forms import models as model_forms from django.http import HttpResponseRedirect -from django.utils import six -from django.utils.deprecation import RemovedInDjango110Warning from django.utils.encoding import force_text from django.views.generic.base import ContextMixin, TemplateResponseMixin, View from django.views.generic.detail import ( @@ -13,28 +8,7 @@ from django.views.generic.detail import ( ) -class FormMixinBase(type): - def __new__(cls, name, bases, attrs): - get_form = attrs.get('get_form') - if get_form and inspect.isfunction(get_form): - try: - inspect.getcallargs(get_form, None) - except TypeError: - warnings.warn( - "`%s.%s.get_form` method must define a default value for " - "its `form_class` argument." % (attrs['__module__'], name), - RemovedInDjango110Warning, stacklevel=2 - ) - - def get_form_with_form_class(self, form_class=None): - if form_class is None: - form_class = self.get_form_class() - return get_form(self, form_class=form_class) - attrs['get_form'] = get_form_with_form_class - return super(FormMixinBase, cls).__new__(cls, name, bases, attrs) - - -class FormMixin(six.with_metaclass(FormMixinBase, ContextMixin)): +class FormMixin(ContextMixin): """ A mixin that provides a way to show and handle a form in a request. """ |
