diff options
| author | Simon Charette <charettes@users.noreply.github.com> | 2017-01-19 02:39:46 -0500 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-19 08:39:46 +0100 |
| commit | cecc079168e8669138728d31611ff3a1e7eb3a9f (patch) | |
| tree | 2415083d44f84c6f206930fc689a8c0e50a98caa /django/forms | |
| parent | a5563963397aeee30c32e3c1dab31bfe453ca89f (diff) | |
Refs #23919 -- Stopped inheriting from object to define new style classes.
Diffstat (limited to 'django/forms')
| -rw-r--r-- | django/forms/boundfield.py | 4 | ||||
| -rw-r--r-- | django/forms/fields.py | 4 | ||||
| -rw-r--r-- | django/forms/forms.py | 2 | ||||
| -rw-r--r-- | django/forms/formsets.py | 2 | ||||
| -rw-r--r-- | django/forms/models.py | 10 | ||||
| -rw-r--r-- | django/forms/renderers.py | 4 | ||||
| -rw-r--r-- | django/forms/widgets.py | 2 |
7 files changed, 13 insertions, 15 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py index dc40bca508..8bed2a8a52 100644 --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -15,7 +15,7 @@ __all__ = ('BoundField',) @html_safe -class BoundField(object): +class BoundField: "A Field plus data" def __init__(self, form, field, name): self.form = form @@ -251,7 +251,7 @@ class BoundField(object): @html_safe -class BoundWidget(object): +class BoundWidget: """ A container class used for iterating over widgets. This is useful for widgets that have choices. For example, the following can be used in a diff --git a/django/forms/fields.py b/django/forms/fields.py index 94a7bbbfc2..20521b26ea 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -44,7 +44,7 @@ __all__ = ( ) -class Field(object): +class Field: widget = TextInput # Default widget to use when rendering this type of Field. hidden_widget = HiddenInput # Default widget to use when rendering this as "hidden". default_validators = [] # Default set of validators @@ -755,7 +755,7 @@ class NullBooleanField(BooleanField): pass -class CallableChoiceIterator(object): +class CallableChoiceIterator: def __init__(self, choices_func): self.choices_func = choices_func diff --git a/django/forms/forms.py b/django/forms/forms.py index de19edb668..7fccdc2b65 100644 --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -58,7 +58,7 @@ class DeclarativeFieldsMetaclass(MediaDefiningClass): @html_safe -class BaseForm(object): +class BaseForm: # This is the main implementation of all the Form logic. Note that this # class is different than Form. See the comments by the Form class for more # information. Any improvements to the form API should be made to *this* diff --git a/django/forms/formsets.py b/django/forms/formsets.py index 964a83d4ca..18a8cabefa 100644 --- a/django/forms/formsets.py +++ b/django/forms/formsets.py @@ -43,7 +43,7 @@ class ManagementForm(Form): @html_safe -class BaseFormSet(object): +class BaseFormSet: """ A collection of instances of the same Form class. """ diff --git a/django/forms/models.py b/django/forms/models.py index 093a7a6078..e5a589bfba 100644 --- a/django/forms/models.py +++ b/django/forms/models.py @@ -184,7 +184,7 @@ def fields_for_model(model, fields=None, exclude=None, widgets=None, return field_dict -class ModelFormOptions(object): +class ModelFormOptions: def __init__(self, options=None): self.model = getattr(options, 'model', None) self.fields = getattr(options, 'fields', None) @@ -517,10 +517,8 @@ def modelform_factory(model, form=ModelForm, fields=None, exclude=None, # If parent form class already has an inner Meta, the Meta we're # creating needs to inherit from the parent's inner meta. - parent = (object,) - if hasattr(form, 'Meta'): - parent = (form.Meta, object) - Meta = type(str('Meta'), parent, attrs) + bases = (form.Meta,) if hasattr(form, 'Meta') else () + Meta = type(str('Meta'), bases, attrs) if formfield_callback: Meta.formfield_callback = staticmethod(formfield_callback) # Give this new form class a reasonable name. @@ -1099,7 +1097,7 @@ class InlineForeignKeyField(Field): return False -class ModelChoiceIterator(object): +class ModelChoiceIterator: def __init__(self, field): self.field = field self.queryset = field.queryset diff --git a/django/forms/renderers.py b/django/forms/renderers.py index 2c31d7adc5..3023d477e4 100644 --- a/django/forms/renderers.py +++ b/django/forms/renderers.py @@ -23,7 +23,7 @@ def get_default_renderer(): return renderer_class() -class BaseRenderer(object): +class BaseRenderer: def get_template(self, template_name): raise NotImplementedError('subclasses must implement get_template()') @@ -32,7 +32,7 @@ class BaseRenderer(object): return template.render(context, request=request).strip() -class EngineMixin(object): +class EngineMixin: def get_template(self, template_name): return self.engine.get_template(template_name) diff --git a/django/forms/widgets.py b/django/forms/widgets.py index b04864205c..d8b4d6a4dc 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -35,7 +35,7 @@ MEDIA_TYPES = ('css', 'js') @html_safe -class Media(object): +class Media: def __init__(self, media=None, **kwargs): if media: media_attrs = media.__dict__ |
