1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Refs #23919 -- Removed str() conversion of type and method __name__.

This commit is contained in:
Simon Charette
2017-01-19 09:48:01 -05:00
parent 41e0033caf
commit 9695b14982
17 changed files with 42 additions and 43 deletions

View File

@@ -441,7 +441,7 @@ def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False,
'min_num': min_num, 'max_num': max_num,
'absolute_max': absolute_max, 'validate_min': validate_min,
'validate_max': validate_max}
return type(form.__name__ + str('FormSet'), (formset,), attrs)
return type(form.__name__ + 'FormSet', (formset,), attrs)
def all_valid(formsets):

View File

@@ -518,11 +518,11 @@ 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.
bases = (form.Meta,) if hasattr(form, 'Meta') else ()
Meta = type(str('Meta'), bases, attrs)
Meta = type('Meta', bases, attrs)
if formfield_callback:
Meta.formfield_callback = staticmethod(formfield_callback)
# Give this new form class a reasonable name.
class_name = model.__name__ + str('Form')
class_name = model.__name__ + 'Form'
# Class attributes for the new form class.
form_class_attrs = {